diff --git a/build-windows.yaml b/build-windows.yaml index 309d9bac23..146a9807c7 100644 --- a/build-windows.yaml +++ b/build-windows.yaml @@ -31,3 +31,20 @@ services: - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}:${JENKINS_VERSION}-jdk17-hotspot-${WINDOWS_FLAVOR}-${WINDOWS_VERSION} - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}:${JENKINS_VERSION}-${WINDOWS_FLAVOR}-${WINDOWS_VERSION} - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}${SEPARATOR_LTS_PREFIX}${WINDOWS_FLAVOR}-${WINDOWS_VERSION} + jdk21: + image: ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}${SEPARATOR_LTS_PREFIX}jdk21-hotspot-${WINDOWS_FLAVOR}-${WINDOWS_VERSION} + build: + context: ./ + dockerfile: ./windows/${WINDOWS_FLAVOR}/hotspot/Dockerfile + args: + COMMIT_SHA: ${COMMIT_SHA} + JAVA_HOME: "C:/openjdk-21" + JAVA_VERSION: "21.0.2_13" + JENKINS_SHA: ${JENKINS_SHA} + JENKINS_VERSION: ${JENKINS_VERSION} + TOOLS_WINDOWS_VERSION: ${TOOLS_WINDOWS_VERSION} + WINDOWS_VERSION: ${WINDOWS_VERSION} + tags: + - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}:${JENKINS_VERSION}-jdk21-hotspot-${WINDOWS_FLAVOR}-${WINDOWS_VERSION} + - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}:${JENKINS_VERSION}-${WINDOWS_FLAVOR}-${WINDOWS_VERSION} + - ${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}${SEPARATOR_LTS_PREFIX}${WINDOWS_FLAVOR}-${WINDOWS_VERSION} diff --git a/tests/functions.Tests.ps1 b/tests/functions.Tests.ps1 index 441280835c..915aba478d 100644 --- a/tests/functions.Tests.ps1 +++ b/tests/functions.Tests.ps1 @@ -20,7 +20,8 @@ Describe "[functions > $global:TEST_TAG] build image" { } } -Describe "[functions > $global:TEST_TAG] Check-VersionLessThan" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[functions > $global:TEST_TAG] Check-VersionLessThan" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'exit codes work' { docker run --rm $global:SUT_IMAGE "exit -1" $LastExitCode | Should -Be -1 @@ -72,7 +73,8 @@ Describe "[functions > $global:TEST_TAG] Check-VersionLessThan" { } } -Describe "[functions > $global:TEST_TAG] Copy-ReferenceFile" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[functions > $global:TEST_TAG] Copy-ReferenceFile" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'build test image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE $PSScriptRoot/functions $exitCode | Should -Be 0 diff --git a/tests/plugins-cli.Tests.ps1 b/tests/plugins-cli.Tests.ps1 index 85656cf44b..5c760f87ef 100644 --- a/tests/plugins-cli.Tests.ps1 +++ b/tests/plugins-cli.Tests.ps1 @@ -28,7 +28,8 @@ Describe "[plugins-cli > $global:TEST_TAG] cleanup container" { } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli $exitCode | Should -Be 0 @@ -62,7 +63,8 @@ Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-pl } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli with non-default REF" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli with non-default REF" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli-ref $PSScriptRoot/plugins-cli/ref $exitCode | Should -Be 0 @@ -99,7 +101,8 @@ Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-pl } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli from a plugins file" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli from a plugins file" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli $exitCode | Should -Be 0 @@ -136,7 +139,8 @@ Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-pl } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli even when already exist" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli even when already exist" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli $exitCode | Should -Be 0 @@ -162,7 +166,8 @@ Describe "[plugins-cli > $global:TEST_TAG] clean work directory" { } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are getting upgraded but not downgraded" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are getting upgraded but not downgraded" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { # Initial execution $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli @@ -212,7 +217,8 @@ Describe "[plugins-cli > $global:TEST_TAG] clean work directory" { } } -Describe "[plugins-cli > $global:TEST_TAG] do not upgrade if plugin has been manually updated" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] do not upgrade if plugin has been manually updated" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli @@ -261,7 +267,8 @@ Describe "[plugins-cli > $global:TEST_TAG] clean work directory" { } } -Describe "[plugins-cli > $global:TEST_TAG] upgrade plugin even if it has been manually updated when PLUGINS_FORCE_UPGRADE=true" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] upgrade plugin even if it has been manually updated when PLUGINS_FORCE_UPGRADE=true" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli $PSScriptRoot/plugins-cli $exitCode | Should -Be 0 @@ -307,14 +314,16 @@ Describe "[plugins-cli > $global:TEST_TAG] clean work directory" { } } -Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli and no war" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] plugins are installed with jenkins-plugin-cli and no war" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli-no-war $PSScriptRoot/plugins-cli/no-war $exitCode | Should -Be 0 } } -Describe "[plugins-cli > $global:TEST_TAG] Use a custom jenkins.war" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[plugins-cli > $global:TEST_TAG] Use a custom jenkins.war" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'builds child image' { $exitCode, $stdout, $stderr = Build-DockerChild $global:SUT_IMAGE-plugins-cli-custom-war $PSScriptRoot/plugins-cli/custom-war --no-cache $exitCode | Should -Be 0 diff --git a/tests/runtime.Tests.ps1 b/tests/runtime.Tests.ps1 index 137d8e96f7..de7e7503ec 100644 --- a/tests/runtime.Tests.ps1 +++ b/tests/runtime.Tests.ps1 @@ -26,7 +26,8 @@ Describe "[runtime > $global:TEST_TAG] cleanup container" { } } -Describe "[runtime > $global:TEST_TAG] test multiple JENKINS_OPTS" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[runtime > $global:TEST_TAG] test multiple JENKINS_OPTS" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It '"--help --version" should return the version, not the help' { # need the last line of output $exitCode, $stdout, $stderr = Run-Program 'docker.exe' "run --rm -e JENKINS_OPTS=`"--help --version`" --name $global:SUT_CONTAINER -P $global:SUT_IMAGE" @@ -35,7 +36,8 @@ Describe "[runtime > $global:TEST_TAG] test multiple JENKINS_OPTS" { } } -Describe "[runtime > $global:TEST_TAG] test jenkins arguments" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[runtime > $global:TEST_TAG] test jenkins arguments" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { It 'running --help --version should return the version, not the help' { # need the last line of output $exitCode, $stdout, $stderr = Run-Program 'docker.exe' "run --rm --name $global:SUT_CONTAINER -P $global:SUT_IMAGE --help --version" @@ -56,7 +58,8 @@ Describe "[runtime > $global:TEST_TAG] test jenkins arguments" { } } -Describe "[runtime > $global:TEST_TAG] passing JVM parameters" { +# Only test on Java 21, one JDK is enough to test all versions +Describe "[runtime > $global:TEST_TAG] passing JVM parameters" -Skip:(-not $global:TEST_TAG.StartsWith('jdk21-')) { BeforeAll { $tzSetting = '-Duser.timezone=Europe/Madrid' $tzRegex = [regex]::Escape("Europe/Madrid")