diff --git a/alpine/Dockerfile-jdk21 b/alpine/Dockerfile-jdk21 new file mode 100644 index 00000000..28d40187 --- /dev/null +++ b/alpine/Dockerfile-jdk21 @@ -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"] diff --git a/debian/Dockerfile-jdk21 b/debian/Dockerfile-jdk21 new file mode 100644 index 00000000..0c761ae8 --- /dev/null +++ b/debian/Dockerfile-jdk21 @@ -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"] diff --git a/docker-bake.hcl b/docker-bake.hcl index 5676d432..f925386e 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,8 +2,10 @@ group "linux" { targets = [ "alpine_jdk11", "alpine_jdk17", + "alpine_jdk21", "debian_jdk11", "debian_jdk17", + "debian_jdk21", ] } @@ -11,6 +13,8 @@ group "linux-arm64" { targets = [ "debian_jdk11", "debian_jdk17", + "debian_jdk21", + "alpine_jdk21", ] } @@ -32,7 +36,7 @@ variable "IMAGE_TAG" { #### This is for the "parent" image version to use (jenkins/agent:-) variable "PARENT_IMAGE_VERSION" { - default = "3148.v532a_7e715ee3-1" + default = "3148.v532a_7e715ee3-4" } variable "REGISTRY" { @@ -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 = "." @@ -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"] +} diff --git a/tests/tests.bats b/tests/tests.bats index 72605188..e81fb4b5 100755 --- a/tests/tests.bats +++ b/tests/tests.bats @@ -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}"