Skip to content

Commit

Permalink
Add java 17 (#95)
Browse files Browse the repository at this point in the history
Co-authored-by: Damien Duportal <[email protected]>
  • Loading branch information
timja and dduportal authored Sep 27, 2021
1 parent e9a46f5 commit fa1331b
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 2 deletions.
1 change: 1 addition & 0 deletions .auto.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
maven_version = "3.8.2"
git_version = "2.33.0"
jdk11_version = "11.0.12+7"
jdk17_version = "17+35"
jdk8_version = "8u302-b08"
git_lfs_version = "2.13.3"
compose_version = "1.29.2"
Expand Down
10 changes: 8 additions & 2 deletions jenkins-agent.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ variable "git_version" {
variable "jdk11_version" {
type = string
}

variable "jdk17_version" {
type = string
}
variable "jdk8_version" {
type = string
}
Expand Down Expand Up @@ -198,8 +202,9 @@ build {
environment_vars = [
"MAVEN_VERSION=${var.maven_version}",
"GIT_VERSION=${var.git_version}",
"JDK11_VERSION=${var.jdk11_version}",
"JDK8_VERSION=${var.jdk8_version}",
"JDK11_VERSION=${var.jdk11_version}",
"JDK17_VERSION=${var.jdk17_version}",
"GIT_LFS_VERSION=${var.git_lfs_version}",
"COMPOSE_VERSION=${var.compose_version}",
"ARCHITECTURE=${var.architecture}",
Expand Down Expand Up @@ -260,8 +265,9 @@ build {
environment_vars = [
"MAVEN_VERSION=${var.maven_version}",
"GIT_VERSION=${var.git_version}",
"JDK11_VERSION=${var.jdk11_version}",
"JDK8_VERSION=${var.jdk8_version}",
"JDK11_VERSION=${var.jdk11_version}",
"JDK17_VERSION=${var.jdk17_version}",
"GIT_LFS_VERSION=${var.git_lfs_version}",
"COMPOSE_VERSION=${var.compose_version}",
"CLOUD_TYPE=${var.image_type}",
Expand Down
7 changes: 7 additions & 0 deletions scripts/ubuntu-20-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ curl -sSL -o /tmp/jdk11.tgz \
tar xzf /tmp/jdk11.tgz -C /opt
update-alternatives --install /usr/bin/java java /opt/jdk-${JDK11_VERSION}/bin/java 11

# JDK17
jdk17_short_version="$(echo "${JDK17_VERSION}" | sed 's/+/_/g')"
curl -sSL -o /tmp/jdk17.tgz \
"https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${JDK17_VERSION}/OpenJDK17-jdk_${cpu_arch_short}_linux_hotspot_${jdk17_short_version}.tar.gz"
tar xzf /tmp/jdk17.tgz -C /opt
update-alternatives --install /usr/bin/java java /opt/jdk-${JDK17_VERSION}/bin/java 17

## Ensure that docker-compose is installed (version from environment)
curl --fail --silent --location --show-error --output /usr/local/bin/docker-compose \
"https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-Linux-x86_64"
Expand Down
5 changes: 5 additions & 0 deletions scripts/windows-2019-provision.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ $downloads = [ordered]@{
};
'path' = '{0}\jdk-{1}\bin' -f $baseDir,$env:JDK11_VERSION;
};
'jdk17' = @{
'url' = 'https://github.com/adoptium/temurin17-binaries/releases/download/jdk-{0}/OpenJDK17-jdk_x64_windows_hotspot_{1}.zip' -f [System.Web.HTTPUtility]::UrlEncode($env:JDK17_VERSION),$env:JDK17_VERSION.Replace('+', '_');
'local' = "$baseDir\temurin17.zip";
'expandTo' = $baseDir;
};
'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\adoptOpenJDK8.zip";
Expand Down
54 changes: 54 additions & 0 deletions updatecli/updatecli.d/jdk17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: "Bump JDK17 version"
sources:
JDK17Version:
# Version is retrieved from the GitHub source mirror: if there is a release, then you're sure that the artifacts are available
kind: githubRelease
name: Get the latest Adoptium JDK17 version
spec:
owner: "adoptium"
repository: "temurin17-binaries"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
versionFilter:
kind: regex
# jdk-17+35(https://github.com/adoptium/temurin17-binaries/releases/tag/jdk-17%2B35) is OK
pattern: "^jdk-17\\+(\\d*)$"
transformers:
- trimPrefix: "jdk-"
# Retrieve the line defining JDK version from Packer Auto Vars. file (it's a trick to handle partial file update)
packerVarJDK17CurrentLine:
kind: file
name: Get the current Packer Default variable for JDK17 version
spec:
file: .auto.pkrvars.hcl
transformers:
- find: 'jdk17_version.*=.*"(.*?)"'
packerAutoVars:
kind: file
name: Get the complete packer auto vars. file content as a source
depends_on:
- JDK17Version
- packerVarJDK17CurrentLine
spec:
file: .auto.pkrvars.hcl
transformers:
- replacer:
from: '{{ source "packerVarJDK17CurrentLine" }}'
to: 'jdk17_version = "{{ source "JDK17Version" }}"'
targets:
updateJDK17Version:
name: Update the JDK17 version in the Packer default values
sourceID: packerAutoVars
kind: file
spec:
file: ".auto.pkrvars.hcl"
scm:
github:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

0 comments on commit fa1331b

Please sign in to comment.