Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #397 from gounthar/jdk21-preview
Browse files Browse the repository at this point in the history
feat(jdk): Add preview images for jdk21
  • Loading branch information
dduportal committed Sep 8, 2023
2 parents fd18e0b + dcde80d commit 09618e6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
35 changes: 35 additions & 0 deletions alpine/Dockerfile-jdk21
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# The MIT License
#
# Copyright (c) 2015-2020, CloudBees, Inc. and other Jenkins contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

ARG version=3148.v532a_7e715ee3-1
ARG JAVA_MAJOR_VERSION=21
FROM jenkins/agent:"${version}"-alpine-jdk"${JAVA_MAJOR_VERSION}"-preview

ARG user=jenkins

USER root
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
USER ${user}

ENTRYPOINT ["/usr/local/bin/jenkins-agent"]
13 changes: 13 additions & 0 deletions debian/Dockerfile-jdk21
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG version=3148.v532a_7e715ee3-1
ARG JAVA_MAJOR_VERSION=21
FROM jenkins/agent:"${version}"-jdk"${JAVA_MAJOR_VERSION}-preview"

ARG user=jenkins

USER root
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
USER ${user}

ENTRYPOINT ["/usr/local/bin/jenkins-agent"]
36 changes: 35 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ group "linux" {
targets = [
"alpine_jdk11",
"alpine_jdk17",
"alpine_jdk21",
"debian_jdk11",
"debian_jdk17",
"debian_jdk21",
]
}

group "linux-arm64" {
targets = [
"debian_jdk11",
"debian_jdk17",
"debian_jdk21",
"alpine_jdk21",
]
}

Expand All @@ -32,7 +36,7 @@ variable "IMAGE_TAG" {

#### This is for the "parent" image version to use (jenkins/agent:<PARENT_IMAGE_VERSION>-<base-os>)
variable "PARENT_IMAGE_VERSION" {
default = "3148.v532a_7e715ee3-1"
default = "3148.v532a_7e715ee3-4"
}

variable "REGISTRY" {
Expand Down Expand Up @@ -80,6 +84,21 @@ target "alpine_jdk17" {
platforms = ["linux/amd64"]
}

target "alpine_jdk21" {
dockerfile = "alpine/Dockerfile-jdk21"
context = "."
args = {
JAVA_MAJOR_VERSION = "21"
version = "${PARENT_IMAGE_VERSION}"
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${PARENT_IMAGE_VERSION}-alpine-jdk21-preview": "",
"${REGISTRY}/${JENKINS_REPO}:alpine-jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk21-preview",
]
platforms = ["linux/amd64", "linux/arm64"]
}

target "debian_jdk11" {
dockerfile = "debian/Dockerfile"
context = "."
Expand Down Expand Up @@ -111,3 +130,18 @@ target "debian_jdk17" {
]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le"]
}

target "debian_jdk21" {
dockerfile = "debian/Dockerfile-jdk21"
context = "."
args = {
JAVA_MAJOR_VERSION = "21"
version = "${PARENT_IMAGE_VERSION}"
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${PARENT_IMAGE_VERSION}-jdk21-preview": "",
"${REGISTRY}/${JENKINS_REPO}:jdk21-preview",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk21-preview",
]
platforms = ["linux/amd64", "linux/arm64"]
}
2 changes: 1 addition & 1 deletion tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SUT_IMAGE="$(get_sut_image)"

# Old version used to test overriding the build arguments.
# This old version must have the same tag suffixes as the ones defined in the docker-bake file (`-jdk17`, `jdk11`, etc.)
TEST_VERSION="3131.vf2b_b_798b_ce99"
TEST_VERSION="3148.v532a_7e715ee3"
PARENT_IMAGE_VERSION_SUFFIX="4"

ARG_TEST_VERSION="${TEST_VERSION}-${PARENT_IMAGE_VERSION_SUFFIX}"
Expand Down

0 comments on commit 09618e6

Please sign in to comment.