Skip to content

Commit b3dbb0d

Browse files
authored
Merge pull request #458 from lemeurherve/fixup-refacto
chore(tests) fixup build to pass Windows version image tag as build arg for Pester docker tests
2 parents e1b890c + 8659c40 commit b3dbb0d

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

build.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ Invoke-Expression "$baseDockerCmd config --services" 2>$null | ForEach-Object {
9696

9797
$baseImage = "${windowsType}-${windowsVersion}"
9898
$versionTag = "${RemotingVersion}-${BuildNumber}-${image}"
99+
Write-Host "= PREPARE: Preparing image ${image}, versionTag ${versionTag}"
99100
$tags = @( $image, $versionTag )
100101
if($jdkMajorVersion -eq "$defaultJdk") {
101102
$tags += $baseImage
103+
Write-Host "= PREPARE: Bare image tag ${baseImage}"
102104
}
103105

104106
$builds[$image] = @{
@@ -183,7 +185,7 @@ if($target -eq "test") {
183185
if(![System.String]::IsNullOrWhiteSpace($Build) -and $builds.ContainsKey($Build)) {
184186
Test-Image $Build
185187
} else {
186-
Write-Host "= TEST: Testing all images"
188+
Write-Host "= TEST: Testing all images..."
187189
foreach($image in $builds.Keys) {
188190
Test-Image $image
189191
}

tests/agent.Tests.ps1

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Import-Module -DisableNameChecking -Force $PSScriptRoot/test_helpers.psm1
33
$global:AGENT_IMAGE = Get-EnvOrDefault 'AGENT_IMAGE' ''
44
$global:IMAGE_FOLDER = Get-EnvOrDefault 'IMAGE_FOLDER' ''
55
$global:VERSION = Get-EnvOrDefault 'VERSION' ''
6+
$global:WINDOWS_VERSION_TAG = Get-EnvOrDefault 'WINDOWS_VERSION_TAG' ''
67

78
$items = $global:AGENT_IMAGE.Split("-")
89

@@ -126,7 +127,7 @@ Describe "[$global:AGENT_IMAGE] can be built with custom build arguments" {
126127
BeforeAll {
127128
Push-Location -StackName 'agent' -Path "$PSScriptRoot/.."
128129

129-
$exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"VERSION=${global:TEST_VERSION}`" --build-arg `"user=${global:TEST_USER}`" --build-arg `"AGENT_WORKDIR=${global:TEST_AGENT_WORKDIR}`" -t ${global:AGENT_IMAGE} ${global:IMAGE_FOLDER}"
130+
$exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"VERSION=${global:TEST_VERSION}`" --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWS_VERSION_TAG}`" --build-arg `"user=${global:TEST_USER}`" --build-arg `"AGENT_WORKDIR=${global:TEST_AGENT_WORKDIR}`" -t ${global:AGENT_IMAGE} ${global:IMAGE_FOLDER}"
130131
$exitCode | Should -Be 0
131132

132133
docker run -d -it --name "$global:CONTAINERNAME" -P "$global:AGENT_IMAGE" "$global:CONTAINERSHELL"

tests/test_helpers.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function Run-Program($cmd, $params) {
115115
$stderr = $proc.StandardError.ReadToEnd()
116116
$proc.WaitForExit()
117117
if($proc.ExitCode -ne 0) {
118-
Write-Host "`n`nstdout:`n$stdout`n`nstderr:`n$stderr`n$cmd`n`nparams:`n$param`n`n"
118+
Write-Host "`n`nstdout:`n$stdout`n`nstderr:`n$stderr`n`ncmd:`n$cmd`n`nparams:`n$param`n`n"
119119
}
120120

121121
return $proc.ExitCode, $stdout, $stderr

updatecli/updatecli.d/jdk11.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ conditions:
5454
- arm/v7
5555
image: eclipse-temurin
5656
tag: '{{source "lastVersion" }}-jdk-focal'
57-
checkTemurinNanocore2019DockerImage:
57+
checkTemurinNanoserver2019DockerImage:
5858
kind: dockerimage
59-
name: Check if the container image "eclipse-temurin:<lastVersion>-jdk-windowsservercore-1809" is available
59+
name: Check if the container image "eclipse-temurin:<lastVersion>-jdk-nanoserver-1809" is available
6060
disablesourceinput: true
6161
spec:
6262
architecture: amd64
@@ -82,15 +82,15 @@ targets:
8282
replacepattern: >-
8383
variable${1}"JAVA11_VERSION"${2}{${3}${4}${5}default${6}= "{{ source "lastVersion" }}"
8484
scmid: default
85-
setJDK11VersionWindowsNanoserver1809:
86-
name: "Bump JDK11 version on Windows Nanoserver 1809 image"
85+
setJDK11VersionWindowsNanoserver:
86+
name: "Bump JDK11 version on Windows Nanoserver image"
8787
kind: yaml
8888
spec:
8989
file: build-windows.yaml
9090
key: $.services.jdk11-nanoserver.build.args.JAVA_VERSION
9191
scmid: default
92-
setJDK11VersionWindowsServerLtsc2019:
93-
name: "Bump JDK11 version on Windows Server LTSC 2019 image"
92+
setJDK11VersionWindowsServer:
93+
name: "Bump JDK11 version on Windows Server image"
9494
kind: yaml
9595
spec:
9696
file: build-windows.yaml

updatecli/updatecli.d/jdk17.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ conditions:
5454
- arm/v7
5555
image: eclipse-temurin
5656
tag: '{{source "lastVersion" }}-jdk-focal'
57-
checkTemurinNanocore2019DockerImage:
57+
checkTemurinNanoserver2019DockerImage:
5858
kind: dockerimage
59-
name: Check if the container image "eclipse-temurin:<lastVersion>-jdk-windowsservercore-1809" is available
59+
name: Check if the container image "eclipse-temurin:<lastVersion>-jdk-nanoserver-1809" is available
6060
disablesourceinput: true
6161
spec:
6262
architecture: amd64
@@ -100,15 +100,15 @@ targets:
100100
keyword: ARG
101101
matcher: JAVA_VERSION
102102
scmid: default
103-
setJDK17VersionWindowsNanoserver1809:
104-
name: "Bump JDK17 version on Windows Nanoserver 1809 image"
103+
setJDK17VersionWindowsNanoserver:
104+
name: "Bump JDK17 version on Windows Nanoserver image"
105105
kind: yaml
106106
spec:
107107
file: build-windows.yaml
108108
key: $.services.jdk17-nanoserver.build.args.JAVA_VERSION
109109
scmid: default
110-
setJDK17VersionWindowsServerLtsc2019:
111-
name: "Bump JDK17 version on Windows Server LTSC 2019 image"
110+
setJDK17VersionWindowsServer:
111+
name: "Bump JDK17 version on Windows Server image"
112112
kind: yaml
113113
spec:
114114
file: build-windows.yaml

0 commit comments

Comments
 (0)