Skip to content

Commit

Permalink
Merge pull request #347 from marvinruder/jdk21-temurin
Browse files Browse the repository at this point in the history
Use generally available JDK21 images
  • Loading branch information
dduportal authored Nov 17, 2023
2 parents 0e5a76e + 5c6b816 commit 6aeeb51
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 174 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ make build-<OS>_<JDK_VERSION>
That would give for JDK 11 on Alpine Linux:

```bash
make test-alpine_jdk11
make build-alpine_jdk11
```

#### Building all images
Expand Down
120 changes: 0 additions & 120 deletions alpine/21/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG JAVA_VERSION=17.0.8.1_1
ARG DEBIAN_RELEASE=bookworm-20231030
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-focal AS jre-build
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-jammy AS jre-build

# This Build ARG is populated by Docker
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
Expand Down
7 changes: 4 additions & 3 deletions debian/21/Dockerfile → debian/preview/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG DEBIAN_RELEASE=bookworm-20230904
FROM debian:"${DEBIAN_RELEASE}" AS jre-build
ARG JAVA_VERSION=21+35
ARG JAVA_VERSION=21.0.1+12
# This Build ARG is populated by Docker
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETPLATFORM
Expand All @@ -12,8 +12,9 @@ RUN apt-get update \
&& ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/armv7l/arm/') \
&& JAVA_VERSION_ENCODED=$(printf '%s' "$JAVA_VERSION" | jq -jRr '@uri') \
&& BUILD_NUMBER=$(printf '%s' "$JAVA_VERSION" | cut -d'+' -f2) \
&& JAVA_MAJOR_VERSION=$(printf '%s' "$JAVA_VERSION" | cut -d'+' -f1) \
&& curl -sL https://github.com/adoptium/temurin"${JAVA_MAJOR_VERSION}"-binaries/releases/download/jdk-"${JAVA_VERSION_ENCODED}"-ea-beta/OpenJDK"${JAVA_MAJOR_VERSION}"U-jdk_"${ARCH}"_linux_hotspot_ea_"${JAVA_MAJOR_VERSION}"-0-"${BUILD_NUMBER}".tar.gz | tar xz -C /opt/ \
&& JAVA_MAJOR_VERSION=$(printf '%s' "$JAVA_VERSION" | cut -d'.' -f1) \
&& JAVA_VERSION_KEBAB=$(printf '%s' "$JAVA_VERSION" | sed 's/+/-/g;s/\./-/g') \
&& curl -sL https://github.com/adoptium/temurin"${JAVA_MAJOR_VERSION}"-binaries/releases/download/jdk-"${JAVA_VERSION_ENCODED}"-ea-beta/OpenJDK"${JAVA_MAJOR_VERSION}"U-jdk_"${ARCH}"_linux_hotspot_ea_"${JAVA_VERSION_KEBAB}".tar.gz | tar xz -C /opt/ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
48 changes: 36 additions & 12 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ group "linux" {
"alpine_jdk21",
"debian_jdk11",
"debian_jdk21",
"debian_jdk21-preview",
]
}

Expand All @@ -19,14 +20,14 @@ group "linux-arm64" {

group "linux-arm32" {
targets = [
"debian_jdk21",
"debian_jdk21-preview",
]
}

group "linux-s390x" {
targets = [
"debian_jdk11",
"debian_jdk21"
"debian_jdk21-preview"
]
}

Expand Down Expand Up @@ -71,7 +72,11 @@ variable "JAVA17_VERSION" {
}

variable "JAVA21_VERSION" {
default = "21+35"
default = "21.0.1_12"
}

variable "JAVA21_PREVIEW_VERSION" {
default = "21.0.1+12"
}

variable "DEBIAN_RELEASE" {
Expand Down Expand Up @@ -118,19 +123,19 @@ target "alpine_jdk17" {
}

target "alpine_jdk21" {
dockerfile = "alpine/21/Dockerfile"
dockerfile = "alpine/Dockerfile"
context = "."
args = {
ALPINE_TAG = ALPINE_FULL_TAG
JAVA_VERSION = JAVA21_VERSION
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine-jdk21-preview" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine${ALPINE_SHORT_TAG}-jdk21-preview" : "",
"${REGISTRY}/${JENKINS_REPO}:alpine-jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk21-preview",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine-jdk21" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-alpine${ALPINE_SHORT_TAG}-jdk21" : "",
"${REGISTRY}/${JENKINS_REPO}:alpine-jdk21",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk21",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk21",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk21",
]
platforms = ["linux/amd64", "linux/arm64"]
}
Expand Down Expand Up @@ -176,12 +181,31 @@ target "debian_jdk17" {
}

target "debian_jdk21" {
dockerfile = "debian/21/Dockerfile"
dockerfile = "debian/Dockerfile"
context = "."
args = {
JAVA_VERSION = JAVA21_VERSION
DEBIAN_RELEASE = DEBIAN_RELEASE
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-jdk21" : "",
"${REGISTRY}/${JENKINS_REPO}:bookworm-jdk21",
"${REGISTRY}/${JENKINS_REPO}:debian-jdk21",
"${REGISTRY}/${JENKINS_REPO}:jdk21",
"${REGISTRY}/${JENKINS_REPO}:latest-bookworm-jdk21",
"${REGISTRY}/${JENKINS_REPO}:latest-debian-jdk21",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk21",
]
platforms = ["linux/amd64", "linux/arm64", "linux/ppc64le"]
}

target "debian_jdk21-preview" {
dockerfile = "debian/preview/Dockerfile"
context = "."
args = {
JAVA_VERSION = JAVA21_PREVIEW_VERSION
DEBIAN_RELEASE = DEBIAN_RELEASE
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${VERSION}-jdk21-preview" : "",
"${REGISTRY}/${JENKINS_REPO}:bookworm-jdk21-preview",
Expand All @@ -191,5 +215,5 @@ target "debian_jdk21" {
"${REGISTRY}/${JENKINS_REPO}:latest-debian-jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk21-preview",
]
platforms = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x", "linux/arm/v7"]
platforms = ["linux/s390x", "linux/arm/v7"]
}
7 changes: 4 additions & 3 deletions updatecli/scripts/check-jdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ function get_jdk_download_url() {
echo "https://github.com/adoptium/temurin19-binaries/releases/download/jdk-${jdk_version}/OpenJDK19U-jdk_${platform}_hotspot_${jdk_version//+/_}";
return 0;;
21*)
# JDK version (21+35-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
# TODO: Check both generally available and early access versions, as both are in use within this repository
# JDK version (21.0.1+12-ea-beta)
## https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21%2B35-ea-beta/OpenJDK21U-jdk_aarch64_linux_hotspot_ea_21-0-1-12.tar.gz
urlEncodedJDKVersion="${jdk_version//+/%2B}"
echo "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-${urlEncodedJDKVersion}-ea-beta/OpenJDK21U-jdk_${platform}_hotspot_ea_21-0-$(echo ${jdk_version} | cut -d '+' -f 2 | cut -d '-' -f 1)"
echo "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-${urlEncodedJDKVersion}-ea-beta/OpenJDK21U-jdk_${platform}_hotspot_ea_$(echo ${jdk_version} | sed 's/+/-/g;s/\./-/g')"
return 0;;
*)
echo "ERROR: unsupported JDK version (${jdk_version}).";
Expand Down
4 changes: 2 additions & 2 deletions updatecli/updatecli.d/jdk11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ conditions:
tag: '{{source "jdk11LastVersion" }}-jdk-alpine'
checkTemurinJDK11DebianDockerImages:
kind: dockerimage
name: Check if the container image "eclipse-temurin:<jdk11LastVersion>-jdk-focal" is available
name: Check if the container image "eclipse-temurin:<jdk11LastVersion>-jdk-jammy" is available
disablesourceinput: true
spec:
architectures:
Expand All @@ -53,7 +53,7 @@ conditions:
- s390x
- arm/v7
image: eclipse-temurin
tag: '{{source "jdk11LastVersion" }}-jdk-focal'
tag: '{{source "jdk11LastVersion" }}-jdk-jammy'
checkTemurinJDK11WindowsCoreDockerImage:
kind: dockerimage
name: Check if the container image "eclipse-temurin:<jdk11LastVersion>-jdk-windowsservercore-1809" is available
Expand Down
4 changes: 2 additions & 2 deletions updatecli/updatecli.d/jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ conditions:
tag: '{{source "jdk17LastVersion" }}-jdk-alpine'
checkTemurinJDK17DebianDockerImages:
kind: dockerimage
name: Check if the container image "eclipse-temurin:<jdk17LastVersion>-jdk-focal" is available
name: Check if the container image "eclipse-temurin:<jdk17LastVersion>-jdk-jammy" is available
disablesourceinput: true
spec:
architectures:
Expand All @@ -53,7 +53,7 @@ conditions:
- s390x
- arm/v7
image: eclipse-temurin
tag: '{{source "jdk17LastVersion" }}-jdk-focal'
tag: '{{source "jdk17LastVersion" }}-jdk-jammy'
checkTemurinJDK17WindowsCoreDockerImage:
kind: dockerimage
name: Check if the container image "eclipse-temurin:<jdk17LastVersion>-jdk-windowsservercore-1809" is available
Expand Down
67 changes: 67 additions & 0 deletions updatecli/updatecli.d/jdk21-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: Bump JDK21 EA 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 }}"
temurin21-binaries:
kind: "github"
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "adoptium"
repository: "temurin21-binaries"
token: '{{ requiredEnv .github.token }}'
branch: "main"

sources:
getLatestJDK21EAVersion:
name: Get the latest Adoptium JDK21 EA 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

targets:
setJDK21VersionForBake:
name: "Bump JDK21 EA 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
setJDK21VersionDebian:
name: "Bump JDK21 EA version for Linux images in the Debian Dockerfile"
kind: dockerfile
spec:
file: debian/preview/Dockerfile
instruction:
keyword: "ARG"
matcher: "JAVA_VERSION"
actions:
default:
kind: github/pullrequest
scmid: default
title: Bump JDK21 EA version to {{ source "getLatestJDK21EAVersion" }}
spec:
labels:
- dependencies
Loading

0 comments on commit 6aeeb51

Please sign in to comment.