From 2ded89dae387d64d44df250b1b5079b4cd48833e Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:55:55 +0100 Subject: [PATCH 1/8] feat(jdk21) Use Liberica official build for `linux/arm/v7` --- updatecli/scripts/check-liberica-jdk.sh | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 updatecli/scripts/check-liberica-jdk.sh diff --git a/updatecli/scripts/check-liberica-jdk.sh b/updatecli/scripts/check-liberica-jdk.sh new file mode 100644 index 000000000..89a3bc055 --- /dev/null +++ b/updatecli/scripts/check-liberica-jdk.sh @@ -0,0 +1,42 @@ +#!/bin/bash +set -x +set -eu -o pipefail + +command -v curl >/dev/null 2>&1 || { echo "ERROR: curl command not found. Exiting."; exit 1; } + +function get_jdk_download_url() { + jdk_version="${1}" + platform="${2}" + case "${jdk_version}" in + 21.*) + ENCODED_JAVA_VERSION=$(echo "$jdk_version" | jq "@uri" -jRr) + CONVERTED_ARCH=$(arch | sed -e 's/x86_64/x64/' -e 's/armv7l/arm32/') + echo "https://github.com/bell-sw/Liberica/releases/download/${ENCODED_JAVA_VERSION}/bellsoft-jdk${jdk_version}-linux-${CONVERTED_ARCH}-vfp-hflt" + return 0;; + *) + echo "ERROR: unsupported JDK version (${jdk_version})."; + exit 1;; + esac +} + +case "${1}" in + 21.*) + platforms=("arm32_linux");; + *) + echo "ERROR: unsupported JDK version (${1})."; + exit 1;; +esac + +for platform in "${platforms[@]}" +do + url_to_check="$(get_jdk_download_url "${1}" "${platform}")" + if [[ "${platform}" == *windows* ]] + then + url_to_check+=".zip" + else + url_to_check+=".tar.gz" + fi + >&2 curl --connect-timeout 5 --location --head --fail --silent "${url_to_check}" || { echo "ERROR: the following URL is NOT available: ${url_to_check}."; exit 1; } +done + +echo "OK: all JDK URL for version=${1} are available." \ No newline at end of file From 729382289e0fb7fcc3b67127fd5b886d191d243b Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:56:36 +0100 Subject: [PATCH 2/8] feat(jdk21) Use Liberica official build for `linux/arm/v7` instead of ea-beta Temurin builds. --- debian/{preview => liberica}/Dockerfile | 43 ++++++++++++------------- 1 file changed, 20 insertions(+), 23 deletions(-) rename debian/{preview => liberica}/Dockerfile (72%) diff --git a/debian/preview/Dockerfile b/debian/liberica/Dockerfile similarity index 72% rename from debian/preview/Dockerfile rename to debian/liberica/Dockerfile index 8abb9be70..45140ba69 100644 --- a/debian/preview/Dockerfile +++ b/debian/liberica/Dockerfile @@ -1,16 +1,12 @@ ARG DEBIAN_RELEASE=bookworm-20240311 FROM debian:"${DEBIAN_RELEASE}"-slim as jre-build -ARG JAVA_VERSION +ARG JAVA_VERSION=21.0.2+14 ARG TARGETPLATFORM SHELL ["/bin/bash", "-o", "pipefail", "-c"] -## Example of preview (EA) jdk21 JAVA_VERSION values: -# 21+35 (note: only one number before the "+") -# 21.0.1+12 -## Example of preview (EA) release download link: -# https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21%2B35-ea-beta/OpenJDK21U-jdk_x64_linux_hotspot_ea_21-0-35.tar.gz -# https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12-ea-beta/OpenJDK21U-jdk_x64_alpine-linux_hotspot_ea_21-0-1-12.tar.gz +## Example of Liberica JDK21 download URL +# https://github.com/bell-sw/Liberica/releases/download/21.0.2%2B14/bellsoft-jdk21.0.2+14-linux-arm32-vfp-hflt.tar.gz # hadolint ignore=DL3008 RUN set -x; apt-get update \ @@ -21,23 +17,23 @@ RUN set -x; apt-get update \ && DASHED_JAVA_VERSION=$(echo "$JAVA_VERSION" | sed -e 's/\./-/g' -e 's/+/-/' -e 's/21-35/21-0-35/') \ && JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | cut -d'+' -f1 | cut -d'.' -f1) \ && ENCODED_JAVA_VERSION=$(echo "$JAVA_VERSION" | jq "@uri" -jRr) \ - && CONVERTED_ARCH=$(arch | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/') \ - && wget --quiet https://github.com/adoptium/temurin"${JAVA_MAJOR_VERSION}"-binaries/releases/download/jdk-"${ENCODED_JAVA_VERSION}"-ea-beta/OpenJDK"${JAVA_MAJOR_VERSION}"U-jdk_"${CONVERTED_ARCH}"_linux_hotspot_ea_"${DASHED_JAVA_VERSION}".tar.gz -O /tmp/jdk.tar.gz \ + && TRIMMED_JAVA_VERSION=$(echo "$JAVA_VERSION" | cut -d'+' -f1) \ + && echo "TRIMMED_JAVA_VERSION=$TRIMMED_JAVA_VERSION" > /tmp/env_var \ + # Load the environment variable from the file we just created + && echo 'source /tmp/env_var' >> ~/.bashrc \ + && CONVERTED_ARCH=$(arch | sed -e 's/x86_64/x64/' -e 's/armv7l/arm32/') \ + && wget --quiet https://github.com/bell-sw/Liberica/releases/download/"${ENCODED_JAVA_VERSION}"/bellsoft-jdk"${JAVA_VERSION}"-linux-"${CONVERTED_ARCH}"-vfp-hflt.tar.gz -O /tmp/jdk.tar.gz \ && tar -xzf /tmp/jdk.tar.gz -C /opt/ \ - && rm -f /tmp/jdk.tar.gz - -ENV PATH=/opt/jdk-${JAVA_VERSION}/bin:$PATH - -RUN if test "${TARGETPLATFORM}" != 'linux/arm/v7'; then \ - jlink \ - --add-modules ALL-MODULE-PATH \ - --no-man-pages \ - --compress=zip-6 \ - --output /javaruntime; \ - # It is acceptable to have a larger image in arm/v7 (arm 32 bits) environment. - # Because jlink fails with the error "jmods: Value too large for defined data type" error. + && rm -f /tmp/jdk.tar.gz \ + && source /tmp/env_var \ + && if test "${TARGETPLATFORM}" != 'linux/arm/v7'; then \ + jlink \ + --add-modules ALL-MODULE-PATH \ + --no-man-pages \ + --compress=zip-6 \ + --output /javaruntime; \ else \ - cp -r "/opt/jdk-${JAVA_VERSION}" /javaruntime; \ + cp -r "/opt/jdk-${TRIMMED_JAVA_VERSION}" /javaruntime; \ fi ## Agent image target @@ -99,12 +95,13 @@ LABEL \ org.opencontainers.image.source="https://github.com/jenkinsci/docker-agent" \ org.opencontainers.image.licenses="MIT" -## Inbound Agent image target +# Inbound Agent image target FROM agent AS inbound-agent ARG user=jenkins USER root +RUN find / -name jenkins-agent COPY ../../jenkins-agent /usr/local/bin/jenkins-agent RUN chmod +x /usr/local/bin/jenkins-agent &&\ ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave From a3974f44756be9ea41e6a6635d7d62e10a340154 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:56:53 +0100 Subject: [PATCH 3/8] feat(jdk21) Use Liberica official build for `linux/arm/v7` instead of ea-beta Temurin builds. --- updatecli/updatecli.d/jdk21-arm32.yaml | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 updatecli/updatecli.d/jdk21-arm32.yaml diff --git a/updatecli/updatecli.d/jdk21-arm32.yaml b/updatecli/updatecli.d/jdk21-arm32.yaml new file mode 100644 index 000000000..d04e462f4 --- /dev/null +++ b/updatecli/updatecli.d/jdk21-arm32.yaml @@ -0,0 +1,58 @@ +--- +name: Bump JDK21 Liberica version for all arm32 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 }}" + liberica-binaries: + kind: "github" + spec: + user: "{{ .github.user }}" + email: "{{ .github.email }}" + owner: "bell-sw" + repository: "Liberica" + token: '{{ requiredEnv .github.token }}' + branch: "master" + +sources: + getLatestJDK21LibericaVersion: + name: Get the latest Liberica JDK21 version + kind: gittag + scmid: liberica-binaries + spec: + versionfilter: + kind: regex + pattern: "21.*" + +conditions: + checkIfReleaseIsAvailable: + kind: shell + spec: + command: bash ./updatecli/scripts/check-liberica-jdk.sh # source input value passed as argument + +targets: + setJDK21LibericaVersionDockerBake: + name: "Bump Liberica JDK21 version for Linux arm32 images in the docker-bake.hcl file" + kind: hcl + spec: + file: docker-bake.hcl + path: variable.JAVA21_LIBERICA_VERSION.default + scmid: default + +actions: + default: + kind: github/pullrequest + scmid: default + title: Bump arm32 Liberica JDK21 version to {{ source "getLatestJDK21LibericaVersion" }} + spec: + labels: + - dependencies + - jdk21-liberica From ded3b7e48df87c113c0217f98acdb73f29051ed2 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:57:06 +0100 Subject: [PATCH 4/8] feat(jdk21) Use Liberica official build for `linux/arm/v7` instead of ea-beta Temurin builds. --- docker-bake.hcl | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 356dfb73b..a9e5be1b3 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -7,7 +7,7 @@ group "linux" { "debian_jdk11", "debian_jdk17", "debian_jdk21", - "debian_jdk21_preview" + "debian_jdk21_liberica" ] } @@ -20,7 +20,7 @@ group "linux-agent-only" { "agent_debian_jdk11", "agent_debian_jdk17", "agent_debian_jdk21", - "agent_debian_jdk21_preview" + "agent_debian_jdk21_liberica" ] } @@ -32,7 +32,7 @@ group "linux-inbound-agent-only" { "inbound-agent_debian_jdk11", "inbound-agent_debian_jdk17", "inbound-agent_debian_jdk21", - "inbound-agent_debian_jdk21_preview" + "inbound-agent_debian_jdk21_liberica" ] } @@ -49,14 +49,14 @@ group "linux-arm32" { targets = [ "debian_jdk11", "debian_jdk17", - "debian_jdk21_preview" + "debian_jdk21_liberica" ] } group "linux-s390x" { targets = [ "debian_jdk11", - "debian_jdk21_preview" + "debian_jdk21" ] } @@ -120,8 +120,8 @@ variable "JAVA21_VERSION" { default = "21.0.2_13" } -variable "JAVA21_PREVIEW_VERSION" { - default = "21.0.1+12" +variable "JAVA21_LIBERICA_VERSION" { + default = "21.0.2+12" } function "orgrepo" { @@ -294,28 +294,28 @@ target "debian_jdk21" { "${REGISTRY}/${orgrepo(type)}:latest-bookworm-jdk21", "${REGISTRY}/${orgrepo(type)}:latest-jdk21", ] - platforms = ["linux/amd64", "linux/arm64", "linux/ppc64le"] + platforms = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"] } -target "debian_jdk21_preview" { +target "debian_jdk21_liberica" { matrix = { type = ["agent", "inbound-agent"] } - name = "${type}_debian_jdk21_preview" + name = "${type}_debian_jdk21_liberica" target = type - dockerfile = "debian/preview/Dockerfile" + dockerfile = "debian/liberica/Dockerfile" context = "." args = { - JAVA_VERSION = JAVA21_PREVIEW_VERSION + JAVA_VERSION = JAVA21_LIBERICA_VERSION VERSION = REMOTING_VERSION DEBIAN_RELEASE = DEBIAN_RELEASE } tags = [ - equal(ON_TAG, "true") ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk21-preview" : "", - "${REGISTRY}/${orgrepo(type)}:bookworm-jdk21-preview", - "${REGISTRY}/${orgrepo(type)}:jdk21-preview", - "${REGISTRY}/${orgrepo(type)}:latest-bookworm-jdk21-preview", - "${REGISTRY}/${orgrepo(type)}:latest-jdk21-preview", + equal(ON_TAG, "true") ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk21-liberica" : "", + "${REGISTRY}/${orgrepo(type)}:bookworm-jdk21-liberica", + "${REGISTRY}/${orgrepo(type)}:jdk21-liberica", + "${REGISTRY}/${orgrepo(type)}:latest-bookworm-jdk21-liberica", + "${REGISTRY}/${orgrepo(type)}:latest-jdk21-liberica", ] - platforms = ["linux/s390x", "linux/arm/v7"] + platforms = [ "linux/arm/v7"] } From 049b8f747eec97943aead2dd1461f4b103ebb4d8 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:57:42 +0100 Subject: [PATCH 5/8] feat(jdk21) Removed logs --- updatecli/scripts/check-liberica-jdk.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/updatecli/scripts/check-liberica-jdk.sh b/updatecli/scripts/check-liberica-jdk.sh index 89a3bc055..fe16017f5 100644 --- a/updatecli/scripts/check-liberica-jdk.sh +++ b/updatecli/scripts/check-liberica-jdk.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -x set -eu -o pipefail command -v curl >/dev/null 2>&1 || { echo "ERROR: curl command not found. Exiting."; exit 1; } From 9b132e287e565660e30e1dc1d2a54dce0c8484c2 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 14:59:26 +0100 Subject: [PATCH 6/8] feat(jdk21) Removed unused script and manifest --- updatecli/scripts/check-jdk.sh | 84 ------------------------ updatecli/updatecli.d/jdk21-preview.yaml | 63 ------------------ 2 files changed, 147 deletions(-) delete mode 100644 updatecli/scripts/check-jdk.sh delete mode 100644 updatecli/updatecli.d/jdk21-preview.yaml diff --git a/updatecli/scripts/check-jdk.sh b/updatecli/scripts/check-jdk.sh deleted file mode 100644 index d16ac594e..000000000 --- a/updatecli/scripts/check-jdk.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# This script checks that the provided JDK version has all the required binaries available for downloads -# as sometimes, the tag for adoptium is published immeidatly while binaries are published later. -## -# The source of truth is the ERB template stored at the location dist/profile/templates/jenkinscontroller/casc/tools.yaml.erb -# It lists all the installations used as "Jenkins Tools" by the Jenkins controllers of the infrastructure -## -set -eu -o pipefail - -command -v curl >/dev/null 2>&1 || { echo "ERROR: curl command not found. Exiting."; exit 1; } - -function get_jdk_download_url() { - jdk_version="${1}" - platform="${2}" - case "${jdk_version}" in - 8*) - ## JDK8 does not have the carret ('-') in their archive names - echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk${jdk_version}/OpenJDK8U-jdk_${platform}_hotspot_${jdk_version//-}"; - return 0;; - 11*) - ## JDK11 URLs have an underscore ('_') instead of a plus ('+') in their archive names - echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-${jdk_version}/OpenJDK11U-jdk_${platform}_hotspot_${jdk_version//+/_}"; - return 0;; - 17*) - ## JDK17 URLs have an underscore ('_') instead of a plus ('+') in their archive names - echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${jdk_version}/OpenJDK17U-jdk_${platform}_hotspot_${jdk_version//+/_}"; - return 0;; - 19*) - ## JDK19 URLs have an underscore ('_') instead of a plus ('+') in their archive names - echo "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-${jdk_version}/OpenJDK19U-jdk_${platform}_hotspot_${jdk_version//+/_}"; - return 0;; - 21*-ea-beta) - # JDK preview version (21+35-ea-beta, 21.0.1+12-ea-beta) - # This has been updated to support the new inferred URL pattern that started as of 21.0.3+2-ea-beta. It will not work for earlier preview versions. - # One could update the cases to support all preview versions, if desired. - jdk_version="${jdk_version//-beta}" - ## https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21%2B35-ea-beta/OpenJDK21U-jdk_aarch64_linux_hotspot_ea_21-0-35.tar.gz - ## https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.1%2B12-ea-beta/OpenJDK21U-jdk_x64_linux_hotspot_ea_21-0-1-12.tar.gz - dashJDKVersion="${jdk_version//+/_}" - jdk_version="${jdk_version//-ea}" - echo "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-${jdk_version//+/%2B}-ea-beta/OpenJDK21U-jdk_${platform}_hotspot_${dashJDKVersion}" - return 0;; - 21*) - ## JDK21 URLs have an underscore ('_') instead of a plus ('+') in their archive names - echo "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-${jdk_version}/OpenJDK21U-jdk_${platform}_hotspot_${jdk_version//+/_}"; - return 0;; - *) - echo "ERROR: unsupported JDK version (${jdk_version})."; - exit 1;; - esac -} - -case "${1}" in - 8u*) - # No s390x support for JDK8: $platforms is kept as default - platforms=("x64_linux" "x64_windows" "aarch64_linux");; - 11.*) - platforms=("x64_linux" "x64_windows" "aarch64_linux" "s390x_linux");; - 17.*+*) - platforms=("x64_linux" "x64_windows" "aarch64_linux" "s390x_linux");; - 19.*+*) - platforms=("x64_linux" "x64_windows" "aarch64_linux" "s390x_linux");; - 21*+*-ea-beta) - platforms=("x64_linux" "x64_windows" "aarch64_linux" "s390x_linux");; - 21*+*) - platforms=("x64_linux" "x64_windows" "aarch64_linux");; - *) - echo "ERROR: unsupported JDK version (${1})."; - exit 1;; -esac - -for platform in "${platforms[@]}" -do - url_to_check="$(get_jdk_download_url "${1}" "${platform}")" - if [[ "${platform}" == *windows* ]] - then - url_to_check+=".zip" - else - url_to_check+=".tar.gz" - fi - >&2 curl --connect-timeout 5 --location --head --fail --silent "${url_to_check}" || { echo "ERROR: the following URL is NOT available: ${url_to_check}."; exit 1; } -done - -echo "OK: all JDK URL for version=${1} are available." diff --git a/updatecli/updatecli.d/jdk21-preview.yaml b/updatecli/updatecli.d/jdk21-preview.yaml deleted file mode 100644 index c6209518b..000000000 --- a/updatecli/updatecli.d/jdk21-preview.yaml +++ /dev/null @@ -1,63 +0,0 @@ ---- -name: Bump JDK21 preview version (EA) 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 }}" - temurin21-binaries: - kind: "github" - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "adoptium" - repository: "temurin21-binaries" - token: '{{ requiredEnv .github.token }}' - branch: "main" - -sources: - getLatestJDK21PreviewVersion: - name: Get the latest Adoptium preview (EA) JDK21 version - kind: gittag - scmid: temurin21-binaries - spec: - versionfilter: - kind: regex - pattern: ".*-ea-.*" - transformers: - - trimprefix: "jdk-" - - trimsuffix: "-ea-beta" - -conditions: - checkIfReleaseIsAvailable: - kind: shell - spec: - command: bash ./updatecli/scripts/check-jdk.sh # source input value passed as argument - transformers: - - addsuffix: "-ea-beta" - -targets: - setJDK21PreviewVersionDockerBake: - name: "Bump preview (EA) JDK21 version for Linux images in the docker-bake.hcl file" - kind: hcl - spec: - file: docker-bake.hcl - path: variable.JAVA21_PREVIEW_VERSION.default - scmid: default - -actions: - default: - kind: github/pullrequest - scmid: default - title: Bump preview (EA) JDK21 version to {{ source "getLatestJDK21PreviewVersion" }} - spec: - labels: - - dependencies - - jdk21-preview From 75e60066297cae747ff55147324de5b3cb799da0 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 15:15:19 +0100 Subject: [PATCH 7/8] fix(jdk21) No need to pin the JAVA_VERSION --- debian/liberica/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/liberica/Dockerfile b/debian/liberica/Dockerfile index 45140ba69..988c236e1 100644 --- a/debian/liberica/Dockerfile +++ b/debian/liberica/Dockerfile @@ -1,6 +1,6 @@ ARG DEBIAN_RELEASE=bookworm-20240311 FROM debian:"${DEBIAN_RELEASE}"-slim as jre-build -ARG JAVA_VERSION=21.0.2+14 +ARG JAVA_VERSION ARG TARGETPLATFORM SHELL ["/bin/bash", "-o", "pipefail", "-c"] From 2bb03210dc35650ebeaa63e42bfacbdc451e4611 Mon Sep 17 00:00:00 2001 From: gounthar Date: Tue, 19 Mar 2024 16:20:46 +0100 Subject: [PATCH 8/8] fix(jdk21) Pins the version to +14. --- docker-bake.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 14d845b73..2070e16de 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -121,7 +121,7 @@ variable "JAVA21_VERSION" { } variable "JAVA21_LIBERICA_VERSION" { - default = "21.0.2+12" + default = "21.0.2+14" } function "orgrepo" {