From f05d396c9b7930b484291a55e9a58d5c3c38b7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 18:25:22 +0200 Subject: [PATCH 01/11] chore: switch to Adoptium archives installers instead of custom scripts --- Jenkinsfile | 8 +- Makefile | 2 +- README.md | 2 +- adoptium/jdk_installers.txt | 14 +++ alpine/Dockerfile | 22 +++-- build.ps1 | 2 +- debian/Dockerfile | 23 +++-- docker-bake.hcl | 124 ++++++++++++--------------- docker-bake.override.json | 14 --- jdk-download-url.sh | 106 ----------------------- jdk-download.sh | 51 ----------- tests/golden/expected_tags.txt | 48 +++++------ tests/sshAgent.Tests.ps1 | 9 +- updatecli/updatecli.d/jdk21.yaml | 90 ------------------- updatecli/updatecli.d/jdk25.yaml | 91 -------------------- updatecli/updatecli.d/jdks.yaml | 72 ++++++++++++++++ windows/nanoserver/Dockerfile | 24 +++--- windows/windowsservercore/Dockerfile | 25 +++--- 18 files changed, 227 insertions(+), 500 deletions(-) create mode 100644 adoptium/jdk_installers.txt delete mode 100644 docker-bake.override.json delete mode 100755 jdk-download-url.sh delete mode 100755 jdk-download.sh delete mode 100644 updatecli/updatecli.d/jdk21.yaml delete mode 100644 updatecli/updatecli.d/jdk25.yaml create mode 100644 updatecli/updatecli.d/jdks.yaml diff --git a/Jenkinsfile b/Jenkinsfile index 1c5f3d73..d3861b21 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,10 +42,10 @@ def agentSelector(String imageType, retryCounter) { // Specify parallel stages def parallelStages = [failFast: false] [ - 'alpine_21', - 'alpine_25', - 'debian_21', - 'debian_25', + 'alpine_jdk21', + 'alpine_jdk25', + 'debian_jdk21', + 'debian_jdk25', 'nanoserver-ltsc2019', 'nanoserver-ltsc2022', 'windowsservercore-ltsc2019', diff --git a/Makefile b/Makefile index f9a88273..fff76d45 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ check_cli = type "$(1)" >/dev/null 2>&1 || { echo "Error: command '$(1)' require check_image = $(MAKE) --silent list listgroup-linux | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image or group '$(1)' does not exist in manifest for the current platform '$(OS)/$(ARCH)'. Please check the output of '$(MAKE) list' or '$(MAKE) listgroup-linux'. Exiting." ; exit 1 ; } # check_image = make --silent list | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image '$(1)' does not exist in manifest for the platform 'linux/$(ARCH)'. Please check the output of 'make list'. Exiting." ; exit 1 ; } ## Base "docker buildx base" command to be reused everywhere -bake_base_cli := docker buildx bake --file docker-bake.hcl --file docker-bake.override.json +bake_base_cli := docker buildx bake --file docker-bake.hcl ## Command to be used on build (only) bake_cli := $(bake_base_cli) --load ## Default bake target diff --git a/README.md b/README.md index cc1bb443..227da28e 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ Note: you can generate this docker compose file from docker-bake.hcl yourself wi # - Convert with yq to the format expected by docker compose # - Store the result in the docker compose file -$ docker buildx bake --progress=plain --file=docker-bake.hcl --file docker-bake.override.json windows --print ` +$ docker buildx bake --progress=plain --file=docker-bake.hcl windows --print ` | yq --prettyPrint '.target[] | del(.output) | {(. | key): {\"image\": .tags[0], \"build\": .}}' | yq '{\"services\": .}' ` | Out-File -FilePath build-windows.yaml ``` diff --git a/adoptium/jdk_installers.txt b/adoptium/jdk_installers.txt new file mode 100644 index 00000000..8ff90288 --- /dev/null +++ b/adoptium/jdk_installers.txt @@ -0,0 +1,14 @@ +jdk21/linux/amd64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/arm64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/ppc64le/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/s390x/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/amd64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_alpine-linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/arm64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_alpine-linux_hotspot_21.0.11_10.tar.gz +jdk21/windows/amd64 https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip +jdk25/linux/amd64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/arm64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/ppc64le/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_ppc64le_linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/s390x/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_s390x_linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/amd64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/arm64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_alpine-linux_hotspot_25.0.3_9.tar.gz +jdk25/windows/amd64 https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip diff --git a/alpine/Dockerfile b/alpine/Dockerfile index f4bb7a53..98877351 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -20,7 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -ARG JAVA_VERSION ARG ALPINE_TAG=3.24.1 FROM alpine:"${ALPINE_TAG}" AS jre-build @@ -30,18 +29,23 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"] # Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope ARG TARGETPLATFORM -COPY jdk-download-url.sh /usr/bin/local/jdk-download-url.sh -COPY jdk-download.sh /usr/bin/local/jdk-download.sh - -ARG JAVA_VERSION +ARG JAVA_RELEASE +COPY ./adoptium/jdk_installers.txt /tmp/jdk_installers.txt +ARG TEMP_JAVA_HOME=/opt/jdk +ENV PATH="${TEMP_JAVA_HOME}/bin:${PATH}" # hadolint ignore=DL3018 RUN apk add --no-cache \ ca-certificates \ - jq \ curl \ - && /usr/bin/local/jdk-download.sh alpine - -ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}" + tar \ + && java_zip_url="$(grep "jdk${JAVA_RELEASE}/${TARGETPLATFORM}/musl" /tmp/jdk_installers.txt | cut -d' ' -f2)" \ + && mkdir -p "${TEMP_JAVA_HOME}" \ + && jdk_archive="/opt/jdk.zip" \ + && curl --silent --show-error --location --output "${jdk_archive}" "${java_zip_url}" \ + # TODO: Verify download with GPG + && tar xzf "${jdk_archive}" --strip-components=1 -C "${TEMP_JAVA_HOME}" \ + && java --version \ + && jlink --version RUN case "$(jlink --version 2>&1)" in \ "21."*) set -- "--compress=zip-6" --add-modules ALL-MODULE-PATH ;; \ diff --git a/build.ps1 b/build.ps1 index 5d4c30f6..bb67c27f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -114,7 +114,7 @@ function Test-Image { } function Initialize-DockerComposeFile { - $baseDockerBakeCmd = 'docker buildx bake --progress=plain --file=docker-bake.hcl --file docker-bake.override.json' + $baseDockerBakeCmd = 'docker buildx bake --progress=plain --file=docker-bake.hcl' $items = $ImageType.Split('-') $windowsFlavor = $items[0] diff --git a/debian/Dockerfile b/debian/Dockerfile index 1db93f40..c16d772c 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -28,19 +28,24 @@ SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"] # Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope ARG TARGETPLATFORM -COPY jdk-download-url.sh /usr/bin/local/jdk-download-url.sh -COPY jdk-download.sh /usr/bin/local/jdk-download.sh - -ARG JAVA_VERSION +ARG JAVA_RELEASE +COPY ./adoptium/jdk_installers.txt /tmp/jdk_installers.txt +ARG TEMP_JAVA_HOME=/opt/jdk +ENV PATH="${TEMP_JAVA_HOME}/bin:${PATH}" # hadolint ignore=DL3008 -RUN set -x; apt-get update \ +RUN apt-get update \ && apt-get install --no-install-recommends -y \ ca-certificates \ - jq \ curl \ - && /usr/bin/local/jdk-download.sh - -ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}" + tar \ + && java_zip_url="$(grep "jdk${JAVA_RELEASE}/${TARGETPLATFORM}/glibc" /tmp/jdk_installers.txt | cut -d' ' -f2)" \ + && mkdir -p "${TEMP_JAVA_HOME}" \ + && jdk_archive="/opt/jdk.zip" \ + && curl --silent --show-error --location --output "${jdk_archive}" "${java_zip_url}" \ + # TODO: Verify download with GPG + && tar xzf "${jdk_archive}" --strip-components=1 -C "${TEMP_JAVA_HOME}" \ + && java --version \ + && jlink --version # Generate smaller java runtime without unneeded files # for now we include the full module path to maintain compatibility diff --git a/docker-bake.hcl b/docker-bake.hcl index 0fc6d4b9..3e1ae957 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,9 +1,9 @@ ## Variables -variable "jdks_to_build" { +variable "java_releases_to_build" { default = [21, 25] } -variable "default_jdk" { +variable "default_java_release" { default = 21 } @@ -31,14 +31,6 @@ variable "ALPINE_SHORT_TAG" { default = regex_replace(ALPINE_FULL_TAG, "\\.\\d+$", "") } -variable "JAVA21_VERSION" { - default = "21.0.11_10" -} - -variable "JAVA25_VERSION" { - default = "25.0.3_9" -} - variable "DEBIAN_RELEASE" { default = "trixie-20260803" } @@ -51,103 +43,101 @@ variable "WINDOWS_VERSION_OVERRIDE" { ## Targets target "alpine" { matrix = { - jdk = jdks_to_build + java_release = java_releases_to_build } - name = "alpine_${jdk}" + name = "alpine_jdk${java_release}" dockerfile = "alpine/Dockerfile" context = "." args = { ALPINE_TAG = ALPINE_FULL_TAG - JAVA_VERSION = "${javaversion(jdk)}" + JAVA_RELEASE = java_release } tags = [ - # If there is a tag, add versioned tags suffixed by the jdk - equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine-jdk${jdk}" : "", - equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine${ALPINE_SHORT_TAG}-jdk${jdk}" : "", - # If the jdk is the default one, add Alpine short tags - is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:alpine" : "", - is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}" : "", - is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}" : "", - "${REGISTRY}/${JENKINS_REPO}:alpine-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk${jdk}", + # If there is a tag, add versioned tags suffixed by the java_release + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine-jdk${java_release}" : "", + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine${ALPINE_SHORT_TAG}-jdk${java_release}" : "", + # If the java_release is the default one, add Alpine short tags + is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:alpine" : "", + is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}" : "", + is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}" : "", + "${REGISTRY}/${JENKINS_REPO}:alpine-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk${java_release}", ] platforms = ["linux/amd64", "linux/arm64"] } target "debian" { matrix = { - jdk = jdks_to_build + java_release = java_releases_to_build } - name = "debian_${jdk}" + name = "debian_jdk${java_release}" dockerfile = "debian/Dockerfile" context = "." args = { DEBIAN_RELEASE = DEBIAN_RELEASE - JAVA_VERSION = "${javaversion(jdk)}" + JAVA_RELEASE = java_release } tags = [ - # If there is a tag, add versioned tag suffixed by the jdk - equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-jdk${jdk}" : "", - # If there is a tag and if the jdk is the default one, add versioned short tag - equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}" : "") : "", - # If the jdk is the default one, add latest short tag - is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:latest" : "", - "${REGISTRY}/${JENKINS_REPO}:trixie-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:debian-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:latest-trixie-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:latest-debian-jdk${jdk}", - "${REGISTRY}/${JENKINS_REPO}:latest-jdk${jdk}", + # If there is a tag, add versioned tag suffixed by the java_release + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-jdk${java_release}" : "", + # If there is a tag and if the java_release is the default one, add versioned short tag + equal(ON_TAG, "true") ? (is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}" : "") : "", + # If the java_release is the default one, add latest short tag + is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:latest" : "", + "${REGISTRY}/${JENKINS_REPO}:trixie-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:debian-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:latest-trixie-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:latest-debian-jdk${java_release}", + "${REGISTRY}/${JENKINS_REPO}:latest-jdk${java_release}", ] platforms = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x", "linux/riscv64"] } target "nanoserver" { matrix = { - jdk = jdks_to_build + java_release = java_releases_to_build windows_version = windowsversions("nanoserver") } - name = "nanoserver-${windows_version}_jdk${jdk}" + name = "nanoserver-${windows_version}_jdk${java_release}" dockerfile = "windows/nanoserver/Dockerfile" context = "." args = { - JAVA_HOME = "C:/openjdk-${jdk}" - JAVA_ZIP_URL = lookup(jdk_installer_urls["windows"]["amd64"], jdk, "Installer URL not found") + JAVA_RELEASE = java_release WINDOWS_VERSION_TAG = windows_version } tags = [ - # If there is a tag, add versioned tag suffixed by the jdk - equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-nanoserver-${windows_version}-jdk${jdk}" : "", - # If there is a tag and if the jdk is the default one, add versioned and short tags - equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-nanoserver-${windows_version}" : "") : "", - equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:nanoserver-${windows_version}" : "") : "", - "${REGISTRY}/${JENKINS_REPO}:nanoserver-${windows_version}-jdk${jdk}", + # If there is a tag, add versioned tag suffixed by the java_release + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-nanoserver-${windows_version}-jdk${java_release}" : "", + # If there is a tag and if the java_release is the default one, add versioned and short tags + equal(ON_TAG, "true") ? (is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-nanoserver-${windows_version}" : "") : "", + equal(ON_TAG, "true") ? (is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:nanoserver-${windows_version}" : "") : "", + "${REGISTRY}/${JENKINS_REPO}:nanoserver-${windows_version}-jdk${java_release}", ] platforms = ["windows/amd64"] } target "windowsservercore" { matrix = { - jdk = jdks_to_build + java_release = java_releases_to_build windows_version = windowsversions("windowsservercore") } - name = "windowsservercore-${windows_version}_jdk${jdk}" + name = "windowsservercore-${windows_version}_jdk${java_release}" dockerfile = "windows/windowsservercore/Dockerfile" context = "." args = { - JAVA_HOME = "C:/openjdk-${jdk}" - JAVA_ZIP_URL = lookup(jdk_installer_urls["windows"]["amd64"], jdk, "Installer URL not found") + JAVA_RELEASE = java_release WINDOWS_VERSION_TAG = windows_version } tags = [ - # If there is a tag, add versioned tag suffixed by the jdk - equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-windowsservercore-${windows_version}-jdk${jdk}" : "", - # If there is a tag and if the jdk is the default one, add versioned and short tags - equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-windowsservercore-${windows_version}" : "") : "", - equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${JENKINS_REPO}:windowsservercore-${windows_version}" : "") : "", - "${REGISTRY}/${JENKINS_REPO}:windowsservercore-${windows_version}-jdk${jdk}", + # If there is a tag, add versioned tag suffixed by the java_release + equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-windowsservercore-${windows_version}-jdk${java_release}" : "", + # If there is a tag and if the java_release is the default one, add versioned and short tags + equal(ON_TAG, "true") ? (is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-windowsservercore-${windows_version}" : "") : "", + equal(ON_TAG, "true") ? (is_default_java_release(java_release) ? "${REGISTRY}/${JENKINS_REPO}:windowsservercore-${windows_version}" : "") : "", + "${REGISTRY}/${JENKINS_REPO}:windowsservercore-${windows_version}-jdk${java_release}", ] platforms = ["windows/amd64"] } @@ -187,18 +177,10 @@ group "linux-ppc64le" { } ## Common functions -# Return "true" if the jdk passed as parameter is the same as the default jdk, "false" otherwise -function "is_default_jdk" { - params = [jdk] - result = equal(default_jdk, jdk) ? "true" : "false" -} - -# Return the complete Java version corresponding to the jdk passed as parameter -function "javaversion" { - params = [jdk] - result = (equal(21, jdk) - ? "${JAVA21_VERSION}" - : "${JAVA25_VERSION}") +# Return "true" if the java_release passed as parameter is the same as the default java_release, "false" otherwise +function "is_default_java_release" { + params = [java_release] + result = equal(default_java_release, java_release) ? "true" : "false" } ## Specific functions diff --git a/docker-bake.override.json b/docker-bake.override.json deleted file mode 100644 index 95058c4c..00000000 --- a/docker-bake.override.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "variable": { - "jdk_installer_urls": { - "default": { - "windows": { - "amd64": { - "21": "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip", - "25": "https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip" - } - } - } - } - } -} diff --git a/jdk-download-url.sh b/jdk-download-url.sh deleted file mode 100755 index dbf175b0..00000000 --- a/jdk-download-url.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh - -# Check if at least one argument was passed to the script -# If one argument was passed and JAVA_VERSION is set, assign the argument to OS -# If two arguments were passed, assign them to JAVA_VERSION and OS respectively -# If three arguments were passed, assign them to JAVA_VERSION, OS and ARCHS respectively -# If not, check if JAVA_VERSION and OS are already set. If they're not set, exit the script with an error message -if [ $# -eq 1 ] && [ -n "$JAVA_VERSION" ]; then - OS=$1 -elif [ $# -eq 2 ]; then - JAVA_VERSION=$1 - OS=$2 -elif [ $# -eq 3 ]; then - JAVA_VERSION=$1 - OS=$2 - ARCHS=$3 -elif [ -z "$JAVA_VERSION" ] && [ -z "$OS" ]; then - echo "Error: No Java version and OS specified. Please set the JAVA_VERSION and OS environment variables or pass them as arguments." >&2 - exit 1 -elif [ -z "$JAVA_VERSION" ]; then - echo "Error: No Java version specified. Please set the JAVA_VERSION environment variable or pass it as an argument." >&2 - exit 1 -elif [ -z "$OS" ]; then - OS=$1 - if [ -z "$OS" ]; then - echo "Error: No OS specified. Please set the OS environment variable or pass it as an argument." >&2 - exit 1 - fi -fi - -# Check if ARCHS is set. If it's not set, assign the current architecture to it -if [ -z "$ARCHS" ]; then - ARCHS=$(uname -m | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/') -else - # Convert ARCHS to an array - OLD_IFS=$IFS - IFS=',' - set -- "$ARCHS" - ARCHS="" - for arch in "$@"; do - ARCHS="$ARCHS $arch" - done - IFS=$OLD_IFS -fi - -# Check if jq and curl are installed -# If they are not installed, exit the script with an error message -if ! command -v jq >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1; then - echo "jq and curl are required but not installed. Exiting with status 1." >&2 - exit 1 -fi - -# Replace underscores with plus signs in JAVA_VERSION -ARCHIVE_DIRECTORY=$(echo "$JAVA_VERSION" | tr '_' '+') - -# URL encode ARCHIVE_DIRECTORY -ENCODED_ARCHIVE_DIRECTORY=$(echo "$ARCHIVE_DIRECTORY" | xargs -I {} printf %s {} | jq "@uri" -jRr) - -# Determine the OS type for the URL -OS_TYPE="linux" -if [ "$OS" = "alpine" ]; then - OS_TYPE="alpine-linux" -fi -if [ "$OS" = "windows" ]; then - OS_TYPE="windows" -fi - -# Initialize a variable to store the URL for the first architecture -FIRST_ARCH_URL="" - -# Loop over the array of architectures -for ARCH in $ARCHS; do - # Fetch the download URL from the Adoptium API - URL="https://api.adoptium.net/v3/binary/version/jdk-${ENCODED_ARCHIVE_DIRECTORY}/${OS_TYPE}/${ARCH}/jdk/hotspot/normal/eclipse?project=jdk" - - if ! RESPONSE=$(curl -fsI "$URL"); then - echo "Error: Failed to fetch the URL for architecture ${ARCH} from ${URL}. Exiting with status 1." >&2 - echo "Response: $RESPONSE" >&2 - exit 1 - fi - - # Extract the redirect URL from the HTTP response - REDIRECTED_URL=$(echo "$RESPONSE" | grep -i location | awk '{print $2}' | tr -d '\r') - - # If no redirect URL was found, exit the script with an error message - if [ -z "$REDIRECTED_URL" ]; then - echo "Error: No redirect URL found for architecture ${ARCH} from ${URL}. Exiting with status 1." >&2 - echo "Response: $RESPONSE" >&2 - exit 1 - fi - - # Use curl to check if the URL is reachable - # If the URL is not reachable, print an error message and exit the script with status 1 - if ! curl -v -fs "$REDIRECTED_URL" >/dev/null 2>&1; then - echo "${REDIRECTED_URL}" is not reachable for architecture "${ARCH}". >&2 - exit 1 - fi - - # If FIRST_ARCH_URL is empty, store the current URL - if [ -z "$FIRST_ARCH_URL" ]; then - FIRST_ARCH_URL=$REDIRECTED_URL - fi -done - -# If all downloads are successful, print the URL for the first architecture -echo "$FIRST_ARCH_URL" diff --git a/jdk-download.sh b/jdk-download.sh deleted file mode 100755 index 51324922..00000000 --- a/jdk-download.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -set -x -# Check if curl and tar are installed -if ! command -v curl >/dev/null 2>&1 || ! command -v tar >/dev/null 2>&1 ; then - echo "curl and tar are required but not installed. Exiting with status 1." >&2 - exit 1 -fi - -# Set the OS to "standard" by default -OS="standard" - -# If a second argument is provided, use it as the OS -if [ $# -eq 1 ]; then - OS=$1 -fi - -# Call jdk-download-url.sh with JAVA_VERSION and OS as arguments -# The two scripts should be in the same directory. -# That's why we're trying to find the directory of the current script and use it to call the other script. -SCRIPT_DIR=$(cd "$(dirname "$0")" || exit; pwd) -if ! DOWNLOAD_URL=$("${SCRIPT_DIR}"/jdk-download-url.sh "${JAVA_VERSION}" "${OS}"); then - echo "Error: Failed to fetch the URL. Exiting with status 1." >&2 - exit 1 -fi - -# Use curl to download the JDK archive from the URL -if ! curl --silent --location --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then - echo "Error: Failed to download the JDK archive. Exiting with status 1." >&2 - exit 1 -fi - -# Extract the archive to the /opt/ directory -if ! tar -xzf /tmp/jdk.tar.gz -C /opt/; then - echo "Error: Failed to extract the JDK archive. Exiting with status 1." >&2 - exit 1 -fi - -# Get the name of the extracted directory -EXTRACTED_DIR=$(tar -tzf /tmp/jdk.tar.gz | head -n 1 | cut -f1 -d"/") - -# Rename the extracted directory to /opt/jdk-${JAVA_VERSION} -if ! mv "/opt/${EXTRACTED_DIR}" "/opt/jdk-${JAVA_VERSION}"; then - echo "Error: Failed to rename the extracted directory. Exiting with status 1." >&2 - exit 1 -fi - -# Remove the downloaded archive -if ! rm -f /tmp/jdk.tar.gz; then - echo "Error: Failed to remove the downloaded archive. Exiting with status 1." >&2 - exit 1 -fi diff --git a/tests/golden/expected_tags.txt b/tests/golden/expected_tags.txt index 1b3a2790..382ab347 100644 --- a/tests/golden/expected_tags.txt +++ b/tests/golden/expected_tags.txt @@ -1,24 +1,24 @@ -docker.io/jenkins/ssh-agent:alpine (alpine_21) -docker.io/jenkins/ssh-agent:alpine-jdk21 (alpine_21) -docker.io/jenkins/ssh-agent:alpine-jdk25 (alpine_25) -docker.io/jenkins/ssh-agent:alpine3.24 (alpine_21) -docker.io/jenkins/ssh-agent:alpine3.24-jdk21 (alpine_21) -docker.io/jenkins/ssh-agent:alpine3.24-jdk25 (alpine_25) -docker.io/jenkins/ssh-agent:debian-jdk21 (debian_21) -docker.io/jenkins/ssh-agent:debian-jdk25 (debian_25) -docker.io/jenkins/ssh-agent:jdk21 (debian_21) -docker.io/jenkins/ssh-agent:jdk25 (debian_25) -docker.io/jenkins/ssh-agent:latest (debian_21) -docker.io/jenkins/ssh-agent:latest-alpine-jdk21 (alpine_21) -docker.io/jenkins/ssh-agent:latest-alpine-jdk25 (alpine_25) -docker.io/jenkins/ssh-agent:latest-alpine3.24 (alpine_21) -docker.io/jenkins/ssh-agent:latest-alpine3.24-jdk21 (alpine_21) -docker.io/jenkins/ssh-agent:latest-alpine3.24-jdk25 (alpine_25) -docker.io/jenkins/ssh-agent:latest-debian-jdk21 (debian_21) -docker.io/jenkins/ssh-agent:latest-debian-jdk25 (debian_25) -docker.io/jenkins/ssh-agent:latest-jdk21 (debian_21) -docker.io/jenkins/ssh-agent:latest-jdk25 (debian_25) -docker.io/jenkins/ssh-agent:latest-trixie-jdk21 (debian_21) -docker.io/jenkins/ssh-agent:latest-trixie-jdk25 (debian_25) -docker.io/jenkins/ssh-agent:trixie-jdk21 (debian_21) -docker.io/jenkins/ssh-agent:trixie-jdk25 (debian_25) +docker.io/jenkins/ssh-agent:alpine (alpine_jdk21) +docker.io/jenkins/ssh-agent:alpine-jdk21 (alpine_jdk21) +docker.io/jenkins/ssh-agent:alpine-jdk25 (alpine_jdk25) +docker.io/jenkins/ssh-agent:alpine3.24 (alpine_jdk21) +docker.io/jenkins/ssh-agent:alpine3.24-jdk21 (alpine_jdk21) +docker.io/jenkins/ssh-agent:alpine3.24-jdk25 (alpine_jdk25) +docker.io/jenkins/ssh-agent:debian-jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:debian-jdk25 (debian_jdk25) +docker.io/jenkins/ssh-agent:jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:jdk25 (debian_jdk25) +docker.io/jenkins/ssh-agent:latest (debian_jdk21) +docker.io/jenkins/ssh-agent:latest-alpine-jdk21 (alpine_jdk21) +docker.io/jenkins/ssh-agent:latest-alpine-jdk25 (alpine_jdk25) +docker.io/jenkins/ssh-agent:latest-alpine3.24 (alpine_jdk21) +docker.io/jenkins/ssh-agent:latest-alpine3.24-jdk21 (alpine_jdk21) +docker.io/jenkins/ssh-agent:latest-alpine3.24-jdk25 (alpine_jdk25) +docker.io/jenkins/ssh-agent:latest-debian-jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:latest-debian-jdk25 (debian_jdk25) +docker.io/jenkins/ssh-agent:latest-jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:latest-jdk25 (debian_jdk25) +docker.io/jenkins/ssh-agent:latest-trixie-jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:latest-trixie-jdk25 (debian_jdk25) +docker.io/jenkins/ssh-agent:trixie-jdk21 (debian_jdk21) +docker.io/jenkins/ssh-agent:trixie-jdk25 (debian_jdk25) diff --git a/tests/sshAgent.Tests.ps1 b/tests/sshAgent.Tests.ps1 index 3f14b094..b8b6e29d 100644 --- a/tests/sshAgent.Tests.ps1 +++ b/tests/sshAgent.Tests.ps1 @@ -1,7 +1,6 @@ Import-Module -DisableNameChecking -Force $PSScriptRoot/test_helpers.psm1 $global:IMAGE_NAME = Get-EnvOrDefault 'IMAGE_NAME' '' # Ex: jenkins4eval/ssh-agent:nanoserver-ltsc2019-jdk25 -$global:JAVA_ZIP_URL = 'https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip' Write-Host "= TESTS: Preparing $global:IMAGE_NAME" @@ -10,7 +9,7 @@ $global:IMAGE_TAG = $imageItems[1] $items = $global:IMAGE_TAG.Split('-') # Remove the 'jdk' prefix -$global:JAVAMAJORVERSION = $items[2].Remove(0,3) +$global:JAVARELEASE = $items[2].Remove(0,3) $global:WINDOWSFLAVOR = $items[0] $global:WINDOWSVERSIONTAG = $items[1] @@ -120,7 +119,7 @@ Describe "[$global:IMAGE_TAG] image has expected tools versions installed and in $exitCode | Should -Be 0 $exitCode, $stdout, $stderr = Run-Program 'docker' "exec $global:CONTAINERNAME $global:CONTAINERSHELL -C `"`$version = java -version 2>&1 ; Write-Host `$version`"" - $stdout.Trim() | Should -Match "^openjdk version `"$global:JAVAMAJORVERSION" + $stdout.Trim() | Should -Match "^openjdk version `"$global:JAVARELEASE" } It 'has expected git-lfs (and thus git) installed and in the path' { @@ -201,7 +200,7 @@ Describe "[$global:IMAGE_TAG] create agent container like docker-plugin with '$g Describe "[$global:IMAGE_TAG] image can be built" { It 'builds image' { - $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_ZIP_URL=${global:JAVA_ZIP_URL}`" --build-arg `"JAVA_HOME=C:\openjdk-${global:JAVAMAJORVERSION}`" --tag=${global:IMAGE_TAG} --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." + $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --tag=${global:IMAGE_TAG} --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." $exitCode | Should -Be 0 } } @@ -216,7 +215,7 @@ Describe "[$global:IMAGE_TAG] image can be built with custom build args" { $TEST_JAW = 'C:/hamster' $CUSTOM_IMAGE_NAME = "custom-${IMAGE_NAME}" - $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_ZIP_URL=${global:JAVA_ZIP_URL}`" --build-arg `"JAVA_HOME=C:\openjdk-${global:JAVAMAJORVERSION}`" --build-arg `"user=$TEST_USER`" --build-arg `"JENKINS_AGENT_WORK=$TEST_JAW`" --tag=$CUSTOM_IMAGE_NAME --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." + $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --build-arg `"user=$TEST_USER`" --build-arg `"JENKINS_AGENT_WORK=$TEST_JAW`" --tag=$CUSTOM_IMAGE_NAME --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." $exitCode | Should -Be 0 $exitCode, $stdout, $stderr = Run-Program 'docker' "run --detach --tty --name=$global:CONTAINERNAME --publish-all $CUSTOM_IMAGE_NAME $global:CONTAINERSHELL" diff --git a/updatecli/updatecli.d/jdk21.yaml b/updatecli/updatecli.d/jdk21.yaml deleted file mode 100644 index 089b87e9..00000000 --- a/updatecli/updatecli.d/jdk21.yaml +++ /dev/null @@ -1,90 +0,0 @@ ---- -name: Bump Temurin's JDK21 version - -scms: - default: - kind: github - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: "{{ requiredEnv .github.token }}" - username: "{{ .github.username }}" - branch: "{{ .github.branch }}" - temurin21-binaries: - kind: "github" - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "adoptium" - repository: "temurin21-binaries" - token: '{{ requiredEnv .github.token }}' - branch: "main" - -sources: - lastVersion: - kind: temurin - name: Get the latest Adoptium JDK21 version - spec: - featureversion: 21 - transformers: - - trimprefix: "jdk-" - windows_x64_installer_url: - name: Retrieve the latest Installer URL (ZIP) for Windows x64 - kind: temurin - spec: - architecture: x64 - featureversion: 21 - operatingsystem: windows - releasetype: ga - result: installer_url - -conditions: - checkTemurinAllReleases: - name: Check if the "" is available for all platforms - kind: temurin - sourceid: lastVersion - spec: - featureversion: 21 - platforms: - - alpine-linux/x64 - - alpine-linux/aarch64 - - linux/x64 - - linux/aarch64 - - linux/ppc64le - - linux/s390x - - windows/x64 - -targets: - setJDK21VersionDockerBake: - name: "Bump JDK21 version for Linux images in the docker-bake.hcl file" - kind: hcl - sourceid: lastVersion - transformers: - - replacer: - from: "+" - to: "_" - spec: - file: docker-bake.hcl - path: variable.JAVA21_VERSION.default - scmid: default - setJDKWindowsInstallerUrl: - name: Bump JDK Installer URL for Windows x64 - kind: json - sourceid: windows_x64_installer_url - spec: - file: docker-bake.override.json - engine: dasel/v2 - key: variable. - scmid: default - -actions: - default: - kind: github/pullrequest - scmid: default - title: Bump JDK21 version to {{ source "lastVersion" }} - spec: - labels: - - dependencies - - jdk21 diff --git a/updatecli/updatecli.d/jdk25.yaml b/updatecli/updatecli.d/jdk25.yaml deleted file mode 100644 index dd53e130..00000000 --- a/updatecli/updatecli.d/jdk25.yaml +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: Bump JDK25 version - -scms: - default: - kind: github - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: "{{ requiredEnv .github.token }}" - username: "{{ .github.username }}" - branch: "{{ .github.branch }}" - temurin25-binaries: - kind: "github" - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "adoptium" - repository: "temurin25-binaries" - token: '{{ requiredEnv .github.token }}' - branch: "main" - -sources: - lastVersion: - kind: temurin - name: Get the latest Adoptium JDK25 version via the API - spec: - featureversion: 25 - transformers: - - trimprefix: "jdk-" - windows_x64_installer_url: - name: Retrieve the latest Installer URL (ZIP) for Windows x64 - kind: temurin - spec: - architecture: x64 - featureversion: 25 - operatingsystem: windows - releasetype: ga - result: installer_url - -# Architectures must match those of the targets in docker-bake.hcl -conditions: - checkTemurinAllReleases: - name: Check if the "" is available for all platforms - kind: temurin - sourceid: lastVersion - spec: - featureversion: 25 - platforms: - - alpine-linux/x64 - - alpine-linux/aarch64 - - linux/x64 - - linux/aarch64 - - linux/ppc64le - - linux/s390x - - windows/x64 - -targets: - setJDK25VersionDockerBake: - name: "Bump JDK25 version in the docker-bake.hcl file" - kind: hcl - sourceid: lastVersion - transformers: - - replacer: - from: "+" - to: "_" - spec: - file: docker-bake.hcl - path: variable.JAVA25_VERSION.default - scmid: default - setJDK25WindowsInstallerUrl: - name: Bump JDK Installer URL for Windows x64 - kind: json - sourceid: windows_x64_installer_url - spec: - file: docker-bake.override.json - engine: dasel/v2 - key: variable.jdk_installer_urls.default.windows.amd64.25 - scmid: default - -actions: - default: - kind: github/pullrequest - scmid: default - title: Bump JDK25 version to {{ source "lastVersion" }} - spec: - labels: - - dependencies - - jdk25 diff --git a/updatecli/updatecli.d/jdks.yaml b/updatecli/updatecli.d/jdks.yaml new file mode 100644 index 00000000..f74ef2a5 --- /dev/null +++ b/updatecli/updatecli.d/jdks.yaml @@ -0,0 +1,72 @@ +{{ $platforms := list "windows/x64" "alpine-linux/x64" "alpine-linux/aarch64" "linux/x64" "linux/aarch64" "linux/ppc64le" "linux/s390x" }} +{{ range $jdkRelease := list 21 25 }} +--- +name: Bump JDK{{ $jdkRelease }} version for all Linux images + +scms: + default: + kind: github + spec: + user: "{{ $.github.user }}" + email: "{{ $.github.email }}" + owner: "{{ $.github.owner }}" + repository: "{{ $.github.repository }}" + token: "{{ requiredEnv $.github.token }}" + username: "{{ $.github.username }}" + branch: "{{ $.github.branch }}" + +sources: + latestJDKVersion: + kind: temurin + name: Get the latest Adoptium JDK{{ $jdkRelease }} version via the API + spec: + featureversion: {{ $jdkRelease }} + transformers: + - trimprefix: "jdk-" + {{- range $platform := $platforms }} + {{- $adoptiumOS := index (splitList "/" $platform) 0 }} + {{- $adoptiumCPU := index (splitList "/" $platform) 1 }} + get_{{ $adoptiumOS }}_{{ $adoptiumCPU }}_installer_url: + name: Retrieve the latest JDK {{ $jdkRelease }} Installer URL for {{ $adoptiumOS | title }} ({{ $adoptiumCPU }}) + kind: temurin + dependson: + - latestJDKVersion + spec: + architecture: {{ $adoptiumCPU }} + operatingsystem: {{ $adoptiumOS }} + specificversion: '{{ source "latestJDKVersion" }}' + releasetype: ga + result: installer_url + {{- end }} + +targets: + {{- range $platform := $platforms }} + {{- $adoptiumOS := index (splitList "/" $platform) 0 }} + {{- $adoptiumCPU := index (splitList "/" $platform) 1 }} + {{- $dockerCPU := ( eq $adoptiumCPU "x64" | ternary "amd64" ( eq $adoptiumCPU "aarch64" | ternary "arm64" $adoptiumCPU )) }} + {{- $prefix := printf "jdk%d/%s/%s" $jdkRelease "windows" "amd64" }} + {{- if ne $adoptiumOS "windows" }} + {{- $prefix = printf "jdk%d/linux/%s/%s" $jdkRelease $dockerCPU (eq $adoptiumOS "alpine-linux" | ternary "musl" "glibc" )}} + {{- end }} + set_{{ $adoptiumOS }}_{{ $adoptiumCPU }}: + name: Bump JDK{{ $jdkRelease }} Installer URL for {{ title $adoptiumOS }} {{ $adoptiumCPU }} + kind: file + sourceid: get_{{ $adoptiumOS }}_{{ $adoptiumCPU }}_installer_url + transformers: + - addprefix: '{{ $prefix }} ' # Trailing slash is important! It's the separator + spec: + file: adoptium/jdk_installers.txt + matchpattern: '{{ $prefix }} (.*)' + #scmid: default + {{- end }} + +actions: + default: + kind: github/pullrequest + scmid: default + title: Bump JDK{{ $jdkRelease }} version to {{ source "latestJDKVersion" }} + spec: + labels: + - dependencies + - jdk{{ $jdkRelease }} +{{- end }} diff --git a/windows/nanoserver/Dockerfile b/windows/nanoserver/Dockerfile index 85ed8942..c0c51dca 100644 --- a/windows/nanoserver/Dockerfile +++ b/windows/nanoserver/Dockerfile @@ -28,16 +28,17 @@ FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}" AS jdk-pwsh # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -ARG JAVA_HOME -ARG JAVA_ZIP_URL -ARG jdkTemp="C:\jdktemp" -ARG localArchive="${jdkTemp}\jdk.zip" -RUN New-Item -ItemType Directory -Path $env:jdkTemp | Out-Null ; ` - Invoke-WebRequest $env:JAVA_ZIP_URL -OutFile $env:localArchive ; ` - Expand-Archive -Path $env:localArchive -DestinationPath $env:jdkTemp ; ` - $expandedDir = Get-ChildItem -Path $env:jdkTemp -Directory | Where-Object { $_.Name -like 'jdk*' } ; ` - Move-Item -Path $expandedDir.FullName -Destination $env:JAVA_HOME -Force ; ` - Remove-Item -Path $env:jdkTemp -Recurse | Out-Null +ARG JAVA_RELEASE +ENV JAVA_HOME="C:/openjdk-${JAVA_RELEASE}" +COPY ./adoptium/jdk_installers.txt "C:\jdk_installers.txt" +RUN $jdkTemp = 'C:\jdktemp' ; ` + $zip = Join-Path $jdkTemp 'jdk.zip' ; ` + New-Item -ItemType Directory -Path $jdkTemp | Out-Null ; ` + $url = (Get-Content .\jdk_installers.txt | Where-Object { $_ -match ('jdk{0}/windows/amd64' -f $env:JAVA_RELEASE) } | Select-Object -First 1).Split(' ')[1] ; ` + Invoke-WebRequest $url -OutFile $zip ; ` + Expand-Archive -Path $zip -DestinationPath $jdkTemp ; ` + $expandedDir = Get-ChildItem -Path $jdkTemp -Directory | Where-Object { $_.Name -like 'jdk*' } ; ` + Move-Item -Path $expandedDir.FullName -Destination $env:JAVA_HOME -Force ARG PWSH_VERSION=7.6.4 RUN $zip = Join-Path $env:TEMP "pwsh.zip" ; ` @@ -50,7 +51,8 @@ RUN $zip = Join-Path $env:TEMP "pwsh.zip" ; ` FROM mcr.microsoft.com/windows/nanoserver:"${WINDOWS_VERSION_TAG}" -ARG JAVA_HOME +ARG JAVA_RELEASE +ENV JAVA_HOME="C:/openjdk-${JAVA_RELEASE}" ENV PSHOME="C:\Program Files\PowerShell" ENV PATH="C:\Windows\system32;C:\Windows;${PSHOME};" diff --git a/windows/windowsservercore/Dockerfile b/windows/windowsservercore/Dockerfile index 4bf753b6..59931186 100644 --- a/windows/windowsservercore/Dockerfile +++ b/windows/windowsservercore/Dockerfile @@ -28,21 +28,22 @@ FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}" AS jdk-core # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -ARG JAVA_HOME -ARG JAVA_ZIP_URL -ARG jdkTemp="C:\jdktemp" -ARG localArchive="${jdkTemp}\jdk.zip" -RUN New-Item -ItemType Directory -Path $env:jdkTemp | Out-Null ; ` - Invoke-WebRequest $env:JAVA_ZIP_URL -OutFile $env:localArchive ; ` - Expand-Archive -Path $env:localArchive -DestinationPath $env:jdkTemp ; ` - $expandedDir = Get-ChildItem -Path $env:jdkTemp -Directory | Where-Object { $_.Name -like 'jdk*' } ; ` - Move-Item -Path $expandedDir.FullName -Destination $env:JAVA_HOME -Force ; ` - Remove-Item -Path $env:jdkTemp -Recurse | Out-Null +ARG JAVA_RELEASE +ENV JAVA_HOME="C:/openjdk-${JAVA_RELEASE}" +COPY ./adoptium/jdk_installers.txt "C:\jdk_installers.txt" +RUN $jdkTemp = 'C:\jdktemp' ; ` + $zip = Join-Path $jdkTemp 'jdk.zip' ; ` + New-Item -ItemType Directory -Path $jdkTemp | Out-Null ; ` + $url = (Get-Content .\jdk_installers.txt | Where-Object { $_ -match ('jdk{0}/windows/amd64' -f $env:JAVA_RELEASE) } | Select-Object -First 1).Split(' ')[1] ; ` + Invoke-WebRequest $url -OutFile $zip ; ` + Expand-Archive -Path $zip -DestinationPath $jdkTemp ; ` + $expandedDir = Get-ChildItem -Path $jdkTemp -Directory | Where-Object { $_.Name -like 'jdk*' } ; ` + Move-Item -Path $expandedDir.FullName -Destination $env:JAVA_HOME -Force FROM mcr.microsoft.com/windows/servercore:"${WINDOWS_VERSION_TAG}" -ARG JAVA_HOME -ENV JAVA_HOME=${JAVA_HOME} +ARG JAVA_RELEASE +ENV JAVA_HOME="C:/openjdk-${JAVA_RELEASE}" COPY --from=jdk-core $JAVA_HOME $JAVA_HOME From 798a77b255f6529782f2fc3bbe06de9bc592dc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 18:32:41 +0200 Subject: [PATCH 02/11] `OverwriteDockerComposeFile` true by default (this option was designed ini tially for local use to avoid overwritting a docker compose file we were working on, kinda outdated now) --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index bb67c27f..b29d40a9 100644 --- a/build.ps1 +++ b/build.ps1 @@ -8,7 +8,7 @@ Param( # Windows flavor and windows version to build [String] $ImageType = 'nanoserver-ltsc2019', # Generate a docker compose file even if it already exists - [switch] $OverwriteDockerComposeFile = $false, + [switch] $OverwriteDockerComposeFile = $true, # Print the build and publish command instead of executing them if set [switch] $DryRun = $false, # Pester version to install and use for tests From cb21beb42fb16f1e38ad70ece5d99f21df549d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 18:33:10 +0200 Subject: [PATCH 03/11] add `JAVA_RELEASE_OVERRIDE` in docker-bake.hcl --- docker-bake.hcl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 3e1ae957..b011f7a7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -40,10 +40,15 @@ variable "WINDOWS_VERSION_OVERRIDE" { default = "" } +# Set this value to a specific version to override java release to build +variable "JAVA_RELEASE_OVERRIDE" { + default = "" +} + ## Targets target "alpine" { matrix = { - java_release = java_releases_to_build + java_release = java_releases(JAVA_RELEASE_OVERRIDE) } name = "alpine_jdk${java_release}" dockerfile = "alpine/Dockerfile" @@ -70,7 +75,7 @@ target "alpine" { target "debian" { matrix = { - java_release = java_releases_to_build + java_release = java_releases(JAVA_RELEASE_OVERRIDE) } name = "debian_jdk${java_release}" dockerfile = "debian/Dockerfile" @@ -98,7 +103,7 @@ target "debian" { target "nanoserver" { matrix = { - java_release = java_releases_to_build + java_release = java_releases(JAVA_RELEASE_OVERRIDE) windows_version = windowsversions("nanoserver") } name = "nanoserver-${windows_version}_jdk${java_release}" @@ -121,7 +126,7 @@ target "nanoserver" { target "windowsservercore" { matrix = { - java_release = java_releases_to_build + java_release = java_releases(JAVA_RELEASE_OVERRIDE) windows_version = windowsversions("windowsservercore") } name = "windowsservercore-${windows_version}_jdk${java_release}" @@ -183,6 +188,15 @@ function "is_default_java_release" { result = equal(default_java_release, java_release) ? "true" : "false" } +# Return array of java releases to build +# Can be overriden to a specific version +function "java_releases" { + params = [override] + result = (notequal(override, "") + ? [override] + : java_releases_to_build) +} + ## Specific functions # Return array of Windows version(s) to build # Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version From 4cf820edb8332d18aab06bd3ecd2f597ebcf9e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 18:33:24 +0200 Subject: [PATCH 04/11] adapt Jenkinsfile --- Jenkinsfile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d3861b21..502fdba4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,6 +39,9 @@ def agentSelector(String imageType, retryCounter) { ]) } +// Specify java release(s) to build for Windows images +def windowsJavaReleases = [21, 25] + // Specify parallel stages def parallelStages = [failFast: false] [ @@ -82,8 +85,12 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make publish' } else { - powershell '& ./build.ps1 build' - powershell '& ./build.ps1 publish' + windowsJavaReleases.each { javaRelease -> + withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { + powershell '& ./build.ps1 build' + powershell '& ./build.ps1 publish' + } + } } } } @@ -94,15 +101,23 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make build' } else { - powershell '& ./build.ps1 build' - archiveArtifacts artifacts: 'build-windows.yaml', allowEmptyArchive: true + windowsJavaReleases.each { javaRelease -> + withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { + powershell '& ./build.ps1 build' + } + } + archiveArtifacts artifacts: 'build-windows*.yaml', allowEmptyArchive: true } } stage('Test') { if (isUnix()) { sh 'make test' } else { - powershell '& ./build.ps1 test' + windowsJavaReleases.each { javaRelease -> + withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { + powershell '& ./build.ps1 test' + } + } } junit 'target/**/junit-results*.xml' } From e00dbad92a88a7ad2d3b02c0150e01027dbb5b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 18:57:52 +0200 Subject: [PATCH 05/11] add missing JDK links for debian riscv64 --- adoptium/jdk_installers.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adoptium/jdk_installers.txt b/adoptium/jdk_installers.txt index 8ff90288..480708dc 100644 --- a/adoptium/jdk_installers.txt +++ b/adoptium/jdk_installers.txt @@ -4,6 +4,7 @@ jdk21/linux/ppc64le/glibc https://github.com/adoptium/temurin21-binaries/release jdk21/linux/s390x/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.11_10.tar.gz jdk21/linux/amd64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_alpine-linux_hotspot_21.0.11_10.tar.gz jdk21/linux/arm64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_alpine-linux_hotspot_21.0.11_10.tar.gz +jdk21/linux/riscv64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_riscv64_linux_hotspot_21.0.11_10.tar.gz jdk21/windows/amd64 https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip jdk25/linux/amd64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_linux_hotspot_25.0.3_9.tar.gz jdk25/linux/arm64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_linux_hotspot_25.0.3_9.tar.gz @@ -11,4 +12,5 @@ jdk25/linux/ppc64le/glibc https://github.com/adoptium/temurin25-binaries/release jdk25/linux/s390x/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_s390x_linux_hotspot_25.0.3_9.tar.gz jdk25/linux/amd64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.3_9.tar.gz jdk25/linux/arm64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_alpine-linux_hotspot_25.0.3_9.tar.gz +jdk25/linux/riscv64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_riscv64_linux_hotspot_25.0.3_9.tar.gz jdk25/windows/amd64 https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip From 93bfc81ee0c2c940931c090325971a1364cc1ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 19:05:20 +0200 Subject: [PATCH 06/11] Revert "adapt Jenkinsfile" This reverts commit 4cf820edb8332d18aab06bd3ecd2f597ebcf9e1f. --- Jenkinsfile | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 502fdba4..d3861b21 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -39,9 +39,6 @@ def agentSelector(String imageType, retryCounter) { ]) } -// Specify java release(s) to build for Windows images -def windowsJavaReleases = [21, 25] - // Specify parallel stages def parallelStages = [failFast: false] [ @@ -85,12 +82,8 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make publish' } else { - windowsJavaReleases.each { javaRelease -> - withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { - powershell '& ./build.ps1 build' - powershell '& ./build.ps1 publish' - } - } + powershell '& ./build.ps1 build' + powershell '& ./build.ps1 publish' } } } @@ -101,23 +94,15 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make build' } else { - windowsJavaReleases.each { javaRelease -> - withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { - powershell '& ./build.ps1 build' - } - } - archiveArtifacts artifacts: 'build-windows*.yaml', allowEmptyArchive: true + powershell '& ./build.ps1 build' + archiveArtifacts artifacts: 'build-windows.yaml', allowEmptyArchive: true } } stage('Test') { if (isUnix()) { sh 'make test' } else { - windowsJavaReleases.each { javaRelease -> - withEnv(["JAVA_RELEASE_OVERRIDE=${javaRelease}"]) { - powershell '& ./build.ps1 test' - } - } + powershell '& ./build.ps1 test' } junit 'target/**/junit-results*.xml' } From 1774d63097eb913fb46ef15e7cc241ec73d34924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 19:05:30 +0200 Subject: [PATCH 07/11] Revert "add `JAVA_RELEASE_OVERRIDE` in docker-bake.hcl" This reverts commit cb21beb42fb16f1e38ad70ece5d99f21df549d01. --- docker-bake.hcl | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index b011f7a7..3e1ae957 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -40,15 +40,10 @@ variable "WINDOWS_VERSION_OVERRIDE" { default = "" } -# Set this value to a specific version to override java release to build -variable "JAVA_RELEASE_OVERRIDE" { - default = "" -} - ## Targets target "alpine" { matrix = { - java_release = java_releases(JAVA_RELEASE_OVERRIDE) + java_release = java_releases_to_build } name = "alpine_jdk${java_release}" dockerfile = "alpine/Dockerfile" @@ -75,7 +70,7 @@ target "alpine" { target "debian" { matrix = { - java_release = java_releases(JAVA_RELEASE_OVERRIDE) + java_release = java_releases_to_build } name = "debian_jdk${java_release}" dockerfile = "debian/Dockerfile" @@ -103,7 +98,7 @@ target "debian" { target "nanoserver" { matrix = { - java_release = java_releases(JAVA_RELEASE_OVERRIDE) + java_release = java_releases_to_build windows_version = windowsversions("nanoserver") } name = "nanoserver-${windows_version}_jdk${java_release}" @@ -126,7 +121,7 @@ target "nanoserver" { target "windowsservercore" { matrix = { - java_release = java_releases(JAVA_RELEASE_OVERRIDE) + java_release = java_releases_to_build windows_version = windowsversions("windowsservercore") } name = "windowsservercore-${windows_version}_jdk${java_release}" @@ -188,15 +183,6 @@ function "is_default_java_release" { result = equal(default_java_release, java_release) ? "true" : "false" } -# Return array of java releases to build -# Can be overriden to a specific version -function "java_releases" { - params = [override] - result = (notequal(override, "") - ? [override] - : java_releases_to_build) -} - ## Specific functions # Return array of Windows version(s) to build # Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version From c3c180f445d59170fab2b7e768535a2980d1a2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 19:05:40 +0200 Subject: [PATCH 08/11] Revert "`OverwriteDockerComposeFile` true by default (this option was designed ini" This reverts commit 798a77b255f6529782f2fc3bbe06de9bc592dc81. --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index b29d40a9..bb67c27f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -8,7 +8,7 @@ Param( # Windows flavor and windows version to build [String] $ImageType = 'nanoserver-ltsc2019', # Generate a docker compose file even if it already exists - [switch] $OverwriteDockerComposeFile = $true, + [switch] $OverwriteDockerComposeFile = $false, # Print the build and publish command instead of executing them if set [switch] $DryRun = $false, # Pester version to install and use for tests From 7bc3aa83055adbdbad0363585c9be8171086b58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 19:40:59 +0200 Subject: [PATCH 09/11] chore(windows): remove `OverwriteDockerComposeFile` obsolete parameter of make.ps1 Same as: - https://github.com/jenkinsci/docker-agents/pull/1321 --- build.ps1 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build.ps1 b/build.ps1 index bb67c27f..b9c84ec2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -7,8 +7,6 @@ Param( [String] $VersionTag = '0.0.1', # Windows flavor and windows version to build [String] $ImageType = 'nanoserver-ltsc2019', - # Generate a docker compose file even if it already exists - [switch] $OverwriteDockerComposeFile = $false, # Print the build and publish command instead of executing them if set [switch] $DryRun = $false, # Pester version to install and use for tests @@ -154,13 +152,9 @@ Test-CommandExists 'docker-compose' Test-CommandExists 'docker buildx' Test-CommandExists 'yq' -# Generate the docker compose file if it doesn't exists or if the parameter OverwriteDockerComposeFile is set -if ((Test-Path $dockerComposeFile) -and -not $OverwriteDockerComposeFile) { - Write-Host "= PREPARE: The docker compose file '$dockerComposeFile' containing the image definitions already exists." -} else { - Write-Host "= PREPARE: Initialize the docker compose file '$dockerComposeFile' containing the image definitions." - Initialize-DockerComposeFile -} +# Generate the docker compose file (warning: will overwrite existing file) +Write-Host "= PREPARE: Initialize the docker compose file '$dockerComposeFile' containing the image definitions." +Initialize-DockerComposeFile Write-Host '= PREPARE: List of images and tags to be processed:' Invoke-Expression "$baseDockerCmd config" From 174e90c0e951c690002c52c4debcc6b41e32e2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 19:44:36 +0200 Subject: [PATCH 10/11] chore(pipeline): build Windows JDK sequentially --- Jenkinsfile | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d3861b21..cc2d9309 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,8 +82,18 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make publish' } else { - powershell '& ./build.ps1 build' - powershell '& ./build.ps1 publish' + // JDK21 only + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl + & ./build.ps1 build + & ./build.ps1 publish + ''' + // JDK25 only + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl + & ./build.ps1 build + & ./build.ps1 publish + ''' } } } @@ -94,15 +104,32 @@ def parallelStages = [failFast: false] if (isUnix()) { sh 'make build' } else { - powershell '& ./build.ps1 build' - archiveArtifacts artifacts: 'build-windows.yaml', allowEmptyArchive: true + // JDK21 only + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl + & ./build.ps1 build + ''' + // JDK25 only + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl + & ./build.ps1 build + ''' + archiveArtifacts artifacts: 'build-windows*.yaml', allowEmptyArchive: true } } stage('Test') { if (isUnix()) { sh 'make test' } else { - powershell '& ./build.ps1 test' + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl + & ./build.ps1 test + ''' + // JDK25 only + powershell ''' + (Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl + & ./build.ps1 test + ''' } junit 'target/**/junit-results*.xml' } From e5b7051fe35acbb85248b458238e4ac8ca180cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Le=20Meur?= Date: Thu, 20 Aug 2026 20:15:44 +0200 Subject: [PATCH 11/11] s/docker build/docker buildx build --load --- tests/sshAgent.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sshAgent.Tests.ps1 b/tests/sshAgent.Tests.ps1 index b8b6e29d..6698a5e0 100644 --- a/tests/sshAgent.Tests.ps1 +++ b/tests/sshAgent.Tests.ps1 @@ -200,7 +200,7 @@ Describe "[$global:IMAGE_TAG] create agent container like docker-plugin with '$g Describe "[$global:IMAGE_TAG] image can be built" { It 'builds image' { - $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --tag=${global:IMAGE_TAG} --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." + $exitCode, $stdout, $stderr = Run-Program 'docker' "buildx build --load --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --tag=${global:IMAGE_TAG} --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." $exitCode | Should -Be 0 } } @@ -215,7 +215,7 @@ Describe "[$global:IMAGE_TAG] image can be built with custom build args" { $TEST_JAW = 'C:/hamster' $CUSTOM_IMAGE_NAME = "custom-${IMAGE_NAME}" - $exitCode, $stdout, $stderr = Run-Program 'docker' "build --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --build-arg `"user=$TEST_USER`" --build-arg `"JENKINS_AGENT_WORK=$TEST_JAW`" --tag=$CUSTOM_IMAGE_NAME --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." + $exitCode, $stdout, $stderr = Run-Program 'docker' "buildx build --load --build-arg `"WINDOWS_VERSION_TAG=${global:WINDOWSVERSIONTAG}`" --build-arg `"JAVA_RELEASE=${global:JAVARELEASE}`" --build-arg `"user=$TEST_USER`" --build-arg `"JENKINS_AGENT_WORK=$TEST_JAW`" --tag=$CUSTOM_IMAGE_NAME --file ./windows/${global:WINDOWSFLAVOR}/Dockerfile ." $exitCode | Should -Be 0 $exitCode, $stdout, $stderr = Run-Program 'docker' "run --detach --tty --name=$global:CONTAINERNAME --publish-all $CUSTOM_IMAGE_NAME $global:CONTAINERSHELL"