-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-73703] Add agent images for UBI 9 #866
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
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 | ||
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope | ||
ARG TARGETPLATFORM | ||
|
||
COPY adoptium-get-jdk-link.sh /usr/bin/local/adoptium-get-jdk-link.sh | ||
COPY adoptium-install-jdk.sh /usr/bin/local/adoptium-install-jdk.sh | ||
|
||
ARG JAVA_VERSION=17.0.12_7 | ||
|
||
RUN dnf install --disableplugin=subscription-manager --setopt=install_weak_deps=0 --setopt=tsflags=nodocs --allowerasing -y \ | ||
ca-certificates \ | ||
curl \ | ||
jq \ | ||
&& dnf clean --disableplugin=subscription-manager all \ | ||
&& /usr/bin/local/adoptium-install-jdk.sh | ||
|
||
ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}" | ||
|
||
# Generate smaller java runtime without unneeded files | ||
# for now we include the full module path to maintain compatibility | ||
# while still saving space (approx 200mb from the full distribution) | ||
RUN case "$(jlink --version 2>&1)" in \ | ||
# jlink version 11 has less features than JDK17+ | ||
"11."*) set -- "--strip-debug" "--compress=2" ;; \ | ||
MarkEWaite marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"17."*) set -- "--strip-java-debug-attributes" "--compress=2" ;; \ | ||
# the compression argument is different for JDK21 | ||
"21."*) set -- "--strip-java-debug-attributes" "--compress=zip-6" ;; \ | ||
*) echo "ERROR: unmanaged jlink version pattern" && exit 1 ;; \ | ||
esac; \ | ||
jlink \ | ||
"$1" \ | ||
"$2" \ | ||
--add-modules ALL-MODULE-PATH \ | ||
--no-man-pages \ | ||
--no-header-files \ | ||
--output /javaruntime | ||
|
||
FROM registry.access.redhat.com/ubi9/ubi:"${UBI9_TAG}" AS agent | ||
|
||
ARG user=jenkins | ||
ARG group=jenkins | ||
ARG uid=1000 | ||
ARG gid=1000 | ||
|
||
RUN groupadd -g "${gid}" "${group}" \ | ||
&& useradd -l -c "Jenkins user" -d /home/"${user}" -u "${uid}" -g "${gid}" -m "${user}" || echo "user ${user} already exists." | ||
|
||
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 \ | ||
fontconfig \ | ||
git \ | ||
git-lfs \ | ||
less \ | ||
patch \ | ||
tzdata \ | ||
&& dnf clean --disableplugin=subscription-manager all | ||
|
||
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}" | ||
ENV USER=${user} | ||
LABEL \ | ||
org.opencontainers.image.vendor="Jenkins project" \ | ||
org.opencontainers.image.title="Official Jenkins Agent Base container image for UBI 9" \ | ||
org.opencontainers.image.description="This is a base image, which provides the Jenkins agent executable (agent.jar)" \ | ||
org.opencontainers.image.version="${VERSION}" \ | ||
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 | ||
|
||
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} | ||
|
||
LABEL \ | ||
org.opencontainers.image.vendor="Jenkins project" \ | ||
org.opencontainers.image.title="Official Jenkins Inbound Agent Base container image for UBI 9" \ | ||
org.opencontainers.image.description="This is an image for Jenkins agents using TCP or WebSockets to establish inbound connection to the Jenkins controller" \ | ||
org.opencontainers.image.version="${VERSION}" \ | ||
org.opencontainers.image.url="https://www.jenkins.io/" \ | ||
org.opencontainers.image.source="https://github.com/jenkinsci/docker-agent" \ | ||
org.opencontainers.image.licenses="MIT" | ||
|
||
ENTRYPOINT ["/usr/local/bin/jenkins-agent"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the
ARG UBI9_TAG
suggestion is accepted, it should also be defined as a variable here and passed to the corresponding target like what is done forDEBIAN_RELEASE
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepting the suggestion, thus I'll add a follow-up commit with the new variable.