Skip to content

Commit

Permalink
feat: add JDK21 version jdk21-2023-08-09-06-56-beta prerelease (#769)
Browse files Browse the repository at this point in the history
* JDK21 version

* ubuntu JDK21 installation

* JDK21 windows installation

* change parameter expansion

* for loop for directory creation

* goss check for JDK21

* change java version test
  • Loading branch information
smerle33 authored Aug 10, 2023
1 parent f4b1666 commit 5333755
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions goss/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ command:
stdout:
- 19.0.2+7
stderr: []
/opt/jdk-21/bin/java --version:
exit-status: 0
stdout:
- 21-beta 2023-09-19
stderr: []
file:
/home/jenkins:
exists: true
Expand Down
1 change: 1 addition & 0 deletions provisioning/tools-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ hadolint_version: 2.12.0
jdk11_version: 11.0.20+8
jdk17_version: 17.0.8+7
jdk19_version: 19.0.2+7
jdk21_version: 2023-08-09-06-56-beta
jdk8_version: 8u382-b05
jenkins_remoting_version: 3142.vcfca_0cd92128
jq_version: 1.6
Expand Down
11 changes: 10 additions & 1 deletion provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ function install_jdk() {
apt-get install --yes --no-install-recommends fontconfig

## OpenJDKs: Adoptium - https://adoptium.net/installation.html
mkdir -p /opt/jdk-8 /opt/jdk-11 /opt/jdk-17 /opt/jdk-19
for jdkVersion in 8 11 17 19 21; do
mkdir -p "/opt/jdk-$jdkVersion"
done

# JDK8
jdk8_short_version="${JDK8_VERSION//-/}"
Expand Down Expand Up @@ -318,13 +320,20 @@ function install_jdk() {
"https://github.com/adoptium/temurin19-binaries/releases/download/jdk-${JDK19_VERSION}/OpenJDK19U-jdk_${cpu_arch_short}_linux_hotspot_${jdk19_short_version}.tar.gz"
tar --extract --gunzip --file=/tmp/jdk19.tgz --directory=/opt/jdk-19 --strip-components=1

# JDK21 https://github.com/adoptium/temurin21-binaries/releases/download/jdk21-2023-08-09-06-56-beta/OpenJDK21U-jdk_aarch64_linux_hotspot_2023-08-09-06-56.tar.gz
jdk21_short_version="${JDK21_VERSION//-beta/}"
curl -sSL -o /tmp/jdk21.tgz \
"https://github.com/adoptium/temurin21-binaries/releases/download/jdk21-${JDK21_VERSION}/OpenJDK21U-jdk_${cpu_arch_short}_linux_hotspot_${jdk21_short_version}.tar.gz"
tar --extract --gunzip --file=/tmp/jdk21.tgz --directory=/opt/jdk-21 --strip-components=1

# Define JDK installations
# The priority of a JDK is the last argument.
# Starts by setting priority to the JDK major version: higher version is the expected default
update-alternatives --install /usr/bin/java java /opt/jdk-8/bin/java 8
update-alternatives --install /usr/bin/java java /opt/jdk-11/bin/java 11
update-alternatives --install /usr/bin/java java /opt/jdk-17/bin/java 17
update-alternatives --install /usr/bin/java java /opt/jdk-19/bin/java 19
update-alternatives --install /usr/bin/java java /opt/jdk-21/bin/java 21
# Then, use the DEFAULT_JDK env var to set the priority of the specified default JDK to 1000 to ensure its the one used by update-alternatives
update-alternatives --install /usr/bin/java java "/opt/jdk-${DEFAULT_JDK}/bin/java" 1000
echo "JAVA_HOME=/opt/jdk-${DEFAULT_JDK}" >> /etc/environment
Expand Down
13 changes: 13 additions & 0 deletions provisioning/windows-provision.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,19 @@ $downloads = [ordered]@{
& "$baseDir\jdk-19\bin\java.exe" -version;
}
};
'jdk21' = @{
'url' = 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk21-{0}/OpenJDK21U-jdk_x64_windows_hotspot_{1}.zip' -f [System.Web.HTTPUtility]::UrlEncode($env:JDK21_VERSION),$env:JDK21_VERSION.Replace('-beta', '');
'local' = "$baseDir\temurin21.zip";
'expandTo' = $baseDir;
'postExpand' = {
& Move-Item -Path "$baseDir\jdk-21*" -Destination "$baseDir\jdk-21"
};
'cleanupLocal' = 'true';
# folder included here since it's not in the PATH
'sanityCheck'= {
& "$baseDir\jdk-21\bin\java.exe" -version;
}
};
'jdk8' = @{
'url' = 'https://github.com/adoptium/temurin8-binaries/releases/download/jdk{0}/OpenJDK8U-jdk_x64_windows_hotspot_{1}.zip' -f $env:JDK8_VERSION,$env:JDK8_VERSION.Replace('-', '');
'local' = "$baseDir\temurin8.zip";
Expand Down

0 comments on commit 5333755

Please sign in to comment.