@@ -148,69 +148,62 @@ Describe "[$global:IMAGE_NAME] image has correct version of java and git-lfs ins
148
148
}
149
149
}
150
150
151
- # TODO: restore when https://github.com/jenkins-infra/helpdesk/issues/4557 infra issue is resolved
152
- # Describe "[$global:IMAGE_NAME] create agent container with pubkey as argument" {
153
- # BeforeAll {
154
- # $exitCode, $stdout, $stderr = Run-Program 'docker' "run --detach --tty --name=`"$global:CONTAINERNAME`" --publish-all `"$global:IMAGE_NAME`" `"$global:PUBLIC_SSH_KEY`""
155
- # $exitCode | Should -Be 0
156
- # Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
157
- # Start-Sleep -Seconds 10
158
- # }
159
-
160
- # It 'runs commands via ssh' {
161
- # $exitCode, $stdout, $stderr = Run-ThruSSH $global:CONTAINERNAME "$global:PRIVATE_SSH_KEY" "$global:CONTAINERSHELL -NoLogo -C `"Write-Host 'f00'`""
162
- # $exitCode | Should -Be 0
163
- # $stdout | Should -Match 'f00'
164
- # }
165
-
166
- # AfterAll {
167
- # Cleanup($global:CONTAINERNAME)
168
- # }
169
- # }
170
-
171
- # TODO: restore when https://github.com/jenkins-infra/helpdesk/issues/4557 infra issue is resolved
172
- # Describe "[$global:IMAGE_NAME] create agent container with pubkey as envvar" {
173
- # BeforeAll {
174
- # $exitCode, $stdout, $stderr = Run-Program 'docker' "run --detach --tty --name=`"$global:CONTAINERNAME`" --publish-all `"$global:IMAGE_NAME`" `"$global:PUBLIC_SSH_KEY`""
175
- # $exitCode | Should -Be 0
176
- # Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
177
- # Start-Sleep -Seconds 10
178
- # }
179
-
180
- # It 'runs commands via ssh' {
181
- # $exitCode, $stdout, $stderr = Run-ThruSSH $global:CONTAINERNAME "$global:PRIVATE_SSH_KEY" "$global:CONTAINERSHELL -NoLogo -C `"Write-Host 'f00'`""
182
- # $exitCode | Should -Be 0
183
- # $stdout | Should -Match 'f00'
184
- # Start-Sleep -Seconds 10
185
- # }
186
-
187
- # AfterAll {
188
- # Cleanup($global:CONTAINERNAME)
189
- # }
190
- # }
191
-
192
-
193
- # TODO: restore when https://github.com/jenkins-infra/helpdesk/issues/4557 infra issue is resolved
194
- # $global:DOCKER_PLUGIN_DEFAULT_ARG="/usr/sbin/sshd -D -p 22"
195
- # Describe "[$global:IMAGE_NAME] create agent container like docker-plugin with '$global:DOCKER_PLUGIN_DEFAULT_ARG' as argument" {
196
- # BeforeAll {
197
- # [string]::IsNullOrWhiteSpace($global:DOCKER_PLUGIN_DEFAULT_ARG) | Should -BeFalse
198
- # $exitCode, $stdout, $stderr = Run-Program 'docker' "run --detach --tty --name=`"$global:CONTAINERNAME`" --publish-all --env=`"JENKINS_AGENT_SSH_PUBKEY=$global:PUBLIC_SSH_KEY`" `"$global:IMAGE_NAME`" `"$global:DOCKER_PLUGIN_DEFAULT_ARG`""
199
- # $exitCode | Should -Be 0
200
- # Is-ContainerRunning $global:CONTAINERNAME | Should -BeTrue
201
- # Start-Sleep -Seconds 10
202
- # }
203
-
204
- # It 'runs commands via ssh' {
205
- # $exitCode, $stdout, $stderr = Run-ThruSSH $global:CONTAINERNAME "$global:PRIVATE_SSH_KEY" "$global:CONTAINERSHELL -NoLogo -C `"Write-Host 'f00'`""
206
- # $exitCode | Should -Be 0
207
- # $stdout | Should -Match 'f00'
208
- # }
209
-
210
- # AfterAll {
211
- # Cleanup($global:CONTAINERNAME)
212
- # }
213
- # }
151
+ Describe " [$global :IMAGE_NAME ] create agent container with pubkey as argument" {
152
+ BeforeAll {
153
+ $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :PUBLIC_SSH_KEY `" "
154
+ $exitCode | Should - Be 0
155
+ Is- ContainerRunning $global :CONTAINERNAME | Should - BeTrue
156
+ }
157
+
158
+ It ' runs commands via ssh' {
159
+ $exitCode , $stdout , $stderr = Run- ThruSSH $global :CONTAINERNAME " $global :PRIVATE_SSH_KEY " " $global :CONTAINERSHELL -NoLogo -C `" Write-Host 'f00'`" "
160
+ $exitCode | Should - Be 0
161
+ $stdout | Should -Match ' f00'
162
+ }
163
+
164
+ AfterAll {
165
+ Cleanup($global :CONTAINERNAME )
166
+ }
167
+ }
168
+
169
+ Describe " [$global :IMAGE_NAME ] create agent container with pubkey as envvar" {
170
+ BeforeAll {
171
+ $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :PUBLIC_SSH_KEY `" "
172
+ $exitCode | Should - Be 0
173
+ Is- ContainerRunning $global :CONTAINERNAME | Should - BeTrue
174
+ }
175
+
176
+ It ' runs commands via ssh' {
177
+ $exitCode , $stdout , $stderr = Run- ThruSSH $global :CONTAINERNAME " $global :PRIVATE_SSH_KEY " " $global :CONTAINERSHELL -NoLogo -C `" Write-Host 'f00'`" "
178
+ $exitCode | Should - Be 0
179
+ $stdout | Should -Match ' f00'
180
+ }
181
+
182
+ AfterAll {
183
+ Cleanup($global :CONTAINERNAME )
184
+ }
185
+ }
186
+
187
+
188
+ $global :DOCKER_PLUGIN_DEFAULT_ARG = " /usr/sbin/sshd -D -p 22"
189
+ Describe " [$global :IMAGE_NAME ] create agent container like docker-plugin with '$global :DOCKER_PLUGIN_DEFAULT_ARG ' as argument" {
190
+ BeforeAll {
191
+ [string ]::IsNullOrWhiteSpace($global :DOCKER_PLUGIN_DEFAULT_ARG ) | Should - BeFalse
192
+ $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all --env=`" JENKINS_AGENT_SSH_PUBKEY=$global :PUBLIC_SSH_KEY `" `" $global :IMAGE_NAME `" `" $global :DOCKER_PLUGIN_DEFAULT_ARG `" "
193
+ $exitCode | Should - Be 0
194
+ Is- ContainerRunning $global :CONTAINERNAME | Should - BeTrue
195
+ }
196
+
197
+ It ' runs commands via ssh' {
198
+ $exitCode , $stdout , $stderr = Run- ThruSSH $global :CONTAINERNAME " $global :PRIVATE_SSH_KEY " " $global :CONTAINERSHELL -NoLogo -C `" Write-Host 'f00'`" "
199
+ $exitCode | Should - Be 0
200
+ $stdout | Should -Match ' f00'
201
+ }
202
+
203
+ AfterAll {
204
+ Cleanup($global :CONTAINERNAME )
205
+ }
206
+ }
214
207
215
208
Describe " [$global :IMAGE_NAME ] build args" {
216
209
BeforeAll {
0 commit comments