@@ -62,14 +62,7 @@ $global:GITLFSVERSION = '3.7.1'
6262
6363Cleanup($global :CONTAINERNAME )
6464
65- Describe " [$global :IMAGE_NAME ] image is present" {
66- It ' builds image' {
67- $exitCode , $stdout , $stderr = Run- Program ' docker' " build --build-arg `" WINDOWS_VERSION_TAG=${ global:WINDOWSVERSIONTAG } `" --build-arg `" TOOLS_WINDOWS_VERSION=${ global:TOOLSWINDOWSVERSION } `" --build-arg `" JAVA_VERSION=${ global:JAVA_VERSION } `" --build-arg `" JAVA_HOME=C:\openjdk-${ global:JAVAMAJORVERSION } `" --tag=${ global:IMAGE_TAG } --file ./windows/${ global:WINDOWSFLAVOR } /Dockerfile ."
68- $exitCode | Should - Be 0
69- }
70- }
71-
72- Describe " [$global :IMAGE_NAME ] image has setup-sshd.ps1 in the correct location" {
65+ Describe " [$global :IMAGE_TAG ] image has setup-sshd.ps1 in the correct location" {
7366 BeforeAll {
7467 $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :CONTAINERSHELL `" "
7568 $exitCode | Should - Be 0
@@ -86,7 +79,7 @@ Describe "[$global:IMAGE_NAME] image has setup-sshd.ps1 in the correct location"
8679 }
8780}
8881
89- Describe " [$global :IMAGE_NAME ] image has no pre-existing SSH host keys" {
82+ Describe " [$global :IMAGE_TAG ] image has no pre-existing SSH host keys" {
9083 BeforeAll {
9184 $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :CONTAINERSHELL `" "
9285 $exitCode | Should - Be 0
@@ -103,7 +96,7 @@ Describe "[$global:IMAGE_NAME] image has no pre-existing SSH host keys" {
10396 }
10497}
10598
106- Describe " [$global :IMAGE_NAME ] checking image metadata" {
99+ Describe " [$global :IMAGE_TAG ] checking image metadata" {
107100 It ' has correct volumes' {
108101 $exitCode , $stdout , $stderr = Run- Program ' docker' " inspect --format '{{.Config.Volumes}}' $global :IMAGE_NAME "
109102 $exitCode | Should - Be 0
@@ -119,7 +112,7 @@ Describe "[$global:IMAGE_NAME] checking image metadata" {
119112 }
120113}
121114
122- Describe " [$global :IMAGE_NAME ] image has correct version of java and git-lfs installed and in the PATH" {
115+ Describe " [$global :IMAGE_TAG ] image has correct version of java and git-lfs installed and in the PATH" {
123116 BeforeAll {
124117 $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :PUBLIC_SSH_KEY `" "
125118 $exitCode | Should - Be 0
@@ -151,7 +144,7 @@ Describe "[$global:IMAGE_NAME] image has correct version of java and git-lfs ins
151144 }
152145}
153146
154- Describe " [$global :IMAGE_NAME ] create agent container with pubkey as argument" {
147+ Describe " [$global :IMAGE_TAG ] create agent container with pubkey as argument" {
155148 BeforeAll {
156149 $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :PUBLIC_SSH_KEY `" "
157150 $exitCode | Should - Be 0
@@ -169,7 +162,7 @@ Describe "[$global:IMAGE_NAME] create agent container with pubkey as argument" {
169162 }
170163}
171164
172- Describe " [$global :IMAGE_NAME ] create agent container with pubkey as envvar" {
165+ Describe " [$global :IMAGE_TAG ] create agent container with pubkey as envvar" {
173166 BeforeAll {
174167 $exitCode , $stdout , $stderr = Run- Program ' docker' " run --detach --tty --name=`" $global :CONTAINERNAME `" --publish-all `" $global :IMAGE_NAME `" `" $global :PUBLIC_SSH_KEY `" "
175168 $exitCode | Should - Be 0
@@ -189,7 +182,7 @@ Describe "[$global:IMAGE_NAME] create agent container with pubkey as envvar" {
189182
190183
191184$global :DOCKER_PLUGIN_DEFAULT_ARG = " /usr/sbin/sshd -D -p 22"
192- Describe " [$global :IMAGE_NAME ] create agent container like docker-plugin with '$global :DOCKER_PLUGIN_DEFAULT_ARG ' as argument" {
185+ Describe " [$global :IMAGE_TAG ] create agent container like docker-plugin with '$global :DOCKER_PLUGIN_DEFAULT_ARG ' as argument" {
193186 BeforeAll {
194187 [string ]::IsNullOrWhiteSpace($global :DOCKER_PLUGIN_DEFAULT_ARG ) | Should - BeFalse
195188 $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 `" "
@@ -208,7 +201,14 @@ Describe "[$global:IMAGE_NAME] create agent container like docker-plugin with '$
208201 }
209202}
210203
211- Describe " [$global :IMAGE_NAME ] build args" {
204+ Describe " [$global :IMAGE_TAG ] image can be built" {
205+ It ' builds image' {
206+ $exitCode , $stdout , $stderr = Run- Program ' docker' " build --build-arg `" WINDOWS_VERSION_TAG=${ global:WINDOWSVERSIONTAG } `" --build-arg `" TOOLS_WINDOWS_VERSION=${ global:TOOLSWINDOWSVERSION } `" --build-arg `" JAVA_VERSION=${ global:JAVA_VERSION } `" --build-arg `" JAVA_HOME=C:\openjdk-${ global:JAVAMAJORVERSION } `" --tag=${ global:IMAGE_TAG } --file ./windows/${ global:WINDOWSFLAVOR } /Dockerfile ."
207+ $exitCode | Should - Be 0
208+ }
209+ }
210+
211+ Describe " [$global :IMAGE_TAG ] image can be built with custom build args" {
212212 BeforeAll {
213213 Push-Location - StackName ' agent' - Path " $PSScriptRoot /.."
214214 }
0 commit comments