Skip to content

Commit

Permalink
[JENKINS-73703] Remove UBI 8 + Review Feedback
Browse files Browse the repository at this point in the history
With the upcoming EOL of Java 11, the UBI 8 image for Jenkins server
will no longer be supported. Creating a UBI 8 image therefore does not
make any sense.

The tag for the base UBI 9 image was converted to a build arg, to
facilitate automatic updates via updatecli. Other minor fixes to
documentation and image metadata also included.

Signed-off-by: Adam Kaplan <[email protected]>
Co-authored-by: Mark Waite <[email protected]>
Co-authored-by: lemeurherveCB <[email protected]>
  • Loading branch information
3 people committed Sep 24, 2024
1 parent ad9f8e1 commit 350499f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 162 deletions.
7 changes: 1 addition & 6 deletions README_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The image has several supported configurations, which can be accessed via the fo
* `jenkins/agent:rhel-ubi9`
* `jenkins/agent:rhel-ubi9-jdk17`
* `jenkins/agent:latest-rhel-ubi9`
* `jenkins/agent:latest-rhel-ubi8-jdk17`
* `jenkins/agent:latest-rhel-ubi9-jdk17`
* Java 21:
* bookworm (Based on `debian:bookworm-${builddate}`):
* `jenkins/agent:bookworm`
Expand Down Expand Up @@ -99,11 +99,6 @@ The image has several supported configurations, which can be accessed via the fo
* `jenkins/agent:archlinux-jdk11`
* `jenkins/agent:latest-archlinux`
* `jenkins/agent:latest-archlinux-jdk11`
* rhel-ubi8 (Based on Red Hat Universal Base Image 8)
* `jenkins/agent:rhel-ubi8`
* `jenkins/agent:rhel-ubi8-jdk11`
* `jenkins/agent:latest-rhel-ubi8`
* `jenkins/agent:latest-rhel-ubi8-jdk11`

* Windows Images:
* Java 17 (default):
Expand Down
43 changes: 7 additions & 36 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ variable "DEBIAN_RELEASE" {
default = "bookworm-20240904"
}

variable "UBI9_TAG" {
default = "9.4-1214.1726694543"
}

variable "JAVA11_VERSION" {
default = "11.0.24_8"
}
Expand Down Expand Up @@ -151,15 +155,8 @@ function "debian_platforms" {
: ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]))
}

# Return an array of RHEL UBI 8 platforms to use depending on the jdk passed as parameter
# Note: Jenkins Docker controller only supports jdk-11 for ubi8
function "rhel_ubi8_platforms" {
params = [jdk]
result = ["linux/amd64", "linux/arm64"]
}

# Return an array of RHEL UBI 8 platforms to use depending on the jdk passed as parameter
# Note: Jenkins Docker controller only supports jdk-17 and jdk-21 for ubi9
# Return an array of RHEL UBI 9 platforms to use depending on the jdk passed as parameter
# Note: Jenkins controller container image only supports jdk17 and jdk21 for ubi9
function "rhel_ubi9_platforms" {
params = [jdk]
result = ["linux/amd64", "linux/arm64", "linux/ppc64le"]
Expand Down Expand Up @@ -248,33 +245,6 @@ target "agent_archlinux_jdk11" {
platforms = ["linux/amd64"]
}

target "rhel_ubi8" {
matrix = {
type = ["agent", "inbound-agent"]
jdk = [11]
}
name = "${type}_rhel_ubi8_jdk${jdk}"
target = type
dockerfile = "rhel/ubi8/Dockerfile"
context = "."
args = {
VERSION = REMOTING_VERSION
JAVA_VERSION = "${javaversion(jdk)}"
}
tags = [
# If there is a tag, add versioned tag suffixed by the jdk
equal(ON_TAG, "true") ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi8-jdk${jdk}" : "",
# If there is a tag and if the jdk is the default one, add versioned short tag
equal(ON_TAG, "true") ? (is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:${REMOTING_VERSION}-${BUILD_NUMBER}-rhel-ubi8" : "") : "",
# If the jdk is the default one, add rhel and latest short tags
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:rhel-ubi8" : "",
is_default_jdk(jdk) ? "${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi8" : "",
"${REGISTRY}/${orgrepo(type)}:rhel-ubi8-jdk${jdk}",
"${REGISTRY}/${orgrepo(type)}:latest-rhel-ubi8-jdk${jdk}",
]
platforms = rhel_ubi8_platforms(jdk)
}

target "rhel_ubi9" {
matrix = {
type = ["agent", "inbound-agent"]
Expand All @@ -285,6 +255,7 @@ target "rhel_ubi9" {
dockerfile = "rhel/ubi9/Dockerfile"
context = "."
args = {
UBI9_TAG = UBI9_TAG
VERSION = REMOTING_VERSION
JAVA_VERSION = "${javaversion(jdk)}"
}
Expand Down
112 changes: 0 additions & 112 deletions rhel/ubi8/Dockerfile

This file was deleted.

17 changes: 9 additions & 8 deletions rhel/ubi9/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM registry.access.redhat.com/ubi9/ubi:9.4-1214 as jre-build
ARG UBI9_TAG="9.4-1214.1726694543"
FROM registry.access.redhat.com/ubi9/ubi:"${UBI9_TAG}" AS jre-build
SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"]

# This Build ARG is populated by Docker
Expand Down Expand Up @@ -38,7 +39,7 @@ RUN case "$(jlink --version 2>&1)" in \
--no-header-files \
--output /javaruntime

FROM registry.access.redhat.com/ubi9/ubi:9.4-1214 AS agent
FROM registry.access.redhat.com/ubi9/ubi:"${UBI9_TAG}" AS agent

ARG user=jenkins
ARG group=jenkins
Expand All @@ -52,7 +53,7 @@ ARG AGENT_WORKDIR=/home/"${user}"/agent
ENV TZ=Etc/UTC

RUN dnf install --disableplugin=subscription-manager --setopt=install_weak_deps=0 --setopt=tsflags=nodocs -y \
ca-certificates \
ca-certificates \
fontconfig \
git \
git-lfs \
Expand All @@ -65,17 +66,17 @@ ARG VERSION=3261.v9c670a_4748a_9
ADD --chown="${user}":"${group}" "https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar" /usr/share/jenkins/agent.jar
RUN chmod 0644 /usr/share/jenkins/agent.jar \
&& ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar

ENV LANG C.UTF-8

ENV JAVA_HOME=/opt/java/openjdk
COPY --from=jre-build /javaruntime "$JAVA_HOME"
ENV PATH="${JAVA_HOME}/bin:${PATH}"

USER "${user}"
ENV AGENT_WORKDIR=${AGENT_WORKDIR}
RUN mkdir -p /home/"${user}"/.jenkins && mkdir -p "${AGENT_WORKDIR}"

VOLUME /home/"${user}"/.jenkins
VOLUME "${AGENT_WORKDIR}"
WORKDIR /home/"${user}"
Expand All @@ -88,7 +89,7 @@ LABEL \
org.opencontainers.image.url="https://www.jenkins.io/" \
org.opencontainers.image.source="https://github.com/jenkinsci/docker-agent" \
org.opencontainers.image.licenses="MIT"

## Inbound Agent image target
FROM agent AS inbound-agent

Expand Down

0 comments on commit 350499f

Please sign in to comment.