Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

privatek8s: track JDK tool installations with updatecli + bump JDK8, JDK11 and JDK17 to latest available version #4634

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions config/jenkins_infra.ci.jenkins.io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -664,48 +664,48 @@ controller:
installers:
- zip:
label: "linux && amd64"
subdir: "jdk8u345-b01"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u345b01.tar.gz"
subdir: "jdk8u392-b08"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u392-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u392b08.tar.gz
- zip:
label: "windows"
subdir: "jdk8u345-b01"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_windows_hotspot_8u345b01.zip"
subdir: "jdk8u392-b08"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u392-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u392b08.zip
- zip:
label: "linux && arm64"
subdir: "jdk8u345-b01"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_aarch64_linux_hotspot_8u345b01.tar.gz"
subdir: "jdk8u392-b08"
url: "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u392-b08/OpenJDK8U-jdk_aarch64_linux_hotspot_8u392b08.tar.gz
- name: "jdk11"
properties:
- installSource:
installers:
- zip:
label: "linux && amd64"
subdir: "jdk-11.0.16.1+1"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16.1+1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.16.1_1.tar.gz"
subdir: "jdk-11.0.21+9"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.21+9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.21_9.tar.gz
- zip:
label: "windows"
subdir: "jdk-11.0.16.1+1"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16.1+1/OpenJDK11U-jdk_x64_windows_hotspot_11.0.16.1_1.zip"
subdir: "jdk-11.0.21+9"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.21+9/OpenJDK11U-jdk_x64_windows_hotspot_11.0.21_9.zip
- zip:
label: "linux && arm64"
subdir: "jdk-11.0.16.1+1"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.16.1+1/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.16.1_1.tar.gz"
subdir: "jdk-11.0.21+9"
url: "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.21+9/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.21_9.tar.gz
- name: "jdk17"
properties:
- installSource:
installers:
- zip:
label: "linux && amd64"
subdir: "jdk-17.0.4.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1+1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.4.1_1.tar.gz"
subdir: "jdk-17.0.8.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_x64_linux_hotspot_17.0.8.1_1.tar.gz
- zip:
label: "windows"
subdir: "jdk-17.0.4.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1+1/OpenJDK17U-jdk_x64_windows_hotspot_17.0.4.1_1.zip"
subdir: "jdk-17.0.8.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_x64_windows_hotspot_17.0.8.1_1.zip
- zip:
label: "linux && arm64"
subdir: "jdk-17.0.4.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.4.1+1/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.4.1_1.tar.gz"
subdir: "jdk-17.0.8.1+1"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.8.1_1.tar.gz
- name: "jdk21"
properties:
- installSource:
Expand Down
73 changes: 73 additions & 0 deletions updatecli/scripts/check-jdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/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 immediatly 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 -eux -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;;
21*-ea-beta)
# JDK preview version (21+35-ea-beta, 21.0.1+12-ea-beta)
jdk_version="${jdk_version//-ea-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//+/-}"
completeDashJDKVersion="${dashJDKVersion//./-}"
echo "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-${jdk_version//+/%2B}-ea-beta/OpenJDK21U-jdk_${platform}_hotspot_ea_${completeDashJDKVersion}"
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*)
platforms=("x64_linux" "x64_windows" "aarch64_linux");;
11.*)
platforms=("x64_linux" "x64_windows" "aarch64_linux");;
17.*+*)
platforms=("x64_linux" "x64_windows" "aarch64_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."
88 changes: 88 additions & 0 deletions updatecli/updatecli.d/jenkins-controllers/tools-jdk11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Bump JDK11 version (Jenkins tools) on all controllers

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:
lastVersion:
kind: githubrelease
spec:
owner: "adoptium"
repository: "temurin11-binaries"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: regex
# jdk-11.0.12+7(https://github.com/adoptium/temurin11-binaries/releases/tag/jdk-11.0.12%2B7) is OK
pattern: "^jdk-11.(\\d*).(\\d*).(\\d*)+(\\d*)$"
escapedVersion:
kind: shell
dependson:
- lastVersion
spec:
command: echo {{ source "lastVersion" }}
transformers:
- trimprefix: jdk-
- replacer:
from: "+"
to: "_"

conditions:
checkIfReleaseIsAvailable:
sourceid: lastVersion
transformers:
- trimprefix: jdk-
kind: shell
spec:
command: bash ./updatecli/scripts/check-jdk.sh # source input value passed as argument

targets:
setJDK11Subdir:
name: "Bump JDK11 version on tools"
sourceid: lastVersion
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: >
subdir: "jdk-11(.*)"
replacepattern: >
subdir: "{{ source `lastVersion` }}"
scmid: default
setJDK11UrlPaths:
name: "Bump JDK11 version on tools"
sourceid: lastVersion
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: download/jdk-11(.*)/
replacepattern: download/{{ source `lastVersion` }}/
scmid: default
setJDK11UrlFilenames:
name: "Bump JDK11 version on tools"
disablesourceinput: true
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: '_11(.*)\.(tar.gz|zip)"'
replacepattern: '_{{ source `escapedVersion` }}.$2"'
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
title: Bump JDK11 version (Jenkins tools) on all controllers to {{ source "lastVersion" }}
spec:
labels:
- dependencies
- jdk11
88 changes: 88 additions & 0 deletions updatecli/updatecli.d/jenkins-controllers/tools-jdk17.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Bump JDK17 version (Jenkins tools) on all controllers

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:
lastVersion:
kind: githubrelease
spec:
owner: "adoptium"
repository: "temurin17-binaries"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionfilter:
kind: regex
# jdk-17.0.12+7(https://github.com/adoptium/temurin17-binaries/releases/tag/jdk-17.0.12%2B7) is OK
pattern: "^jdk-17.(\\d*).(\\d*).(\\d*)+(\\d*)$"
escapedVersion:
kind: shell
dependson:
- lastVersion
spec:
command: echo {{ source "lastVersion" }}
transformers:
- trimprefix: jdk-
- replacer:
from: "+"
to: "_"

conditions:
checkIfReleaseIsAvailable:
sourceid: lastVersion
transformers:
- trimprefix: jdk-
kind: shell
spec:
command: bash ./updatecli/scripts/check-jdk.sh # source input value passed as argument

targets:
setJDK17Subdir:
name: "Bump JDK17 version on tools"
sourceid: lastVersion
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: >
subdir: "jdk-17(.*)"
replacepattern: >
subdir: "{{ source `lastVersion` }}"
# scmid: default
setJDK17UrlPaths:
name: "Bump JDK17 version on tools"
sourceid: lastVersion
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: download/jdk-17(.*)/
replacepattern: download/{{ source `lastVersion` }}/
# scmid: default
setJDK17UrlFilenames:
name: "Bump JDK17 version on tools"
disablesourceinput: true
kind: file
spec:
file: config/jenkins_infra.ci.jenkins.io.yaml
matchpattern: '_17(.*)\.(tar.gz|zip)"'
replacepattern: '_{{ source `escapedVersion` }}.$2"'
# scmid: default

# actions:
# default:
# kind: github/pullrequest
# scmid: default
# title: Bump JDK17 version (Jenkins tools) on all controllers to {{ source "lastVersion" }}
# spec:
# labels:
# - dependencies
# - jdk17
Loading