Skip to content
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

feat: upgrade jenkinsfile-runner to Java 17 and Jenkins version 2.462.3 #723

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions .github/workflows/docker-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:
build-maven:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
java-version: 17
distribution: temurin
- name: Build with Maven
working-directory: .
run: mvn -B package
run: mvn -B package -Dset.changelist -DargLine="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED"

build-docker:
runs-on: ubuntu-latest
Expand All @@ -32,17 +35,22 @@ jobs:
fail-fast: false
matrix:
include:
- alias: jre-11
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile
- alias: jre-17
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile
tags: test
- alias: jre-11-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre-alpine/Dockerfile
- alias: jre-17-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre-alpine/Dockerfile
tags: test-alpine
name: "Build Docker image: ${{ matrix.alias }}"

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.5.0

Expand All @@ -67,16 +75,16 @@ jobs:
fail-fast: false
matrix:
include:
- alias: jre-11
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile
tag-prefix: eclipse-temurin-11-jre-
- alias: jre-17
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile
tag-prefix: eclipse-temurin-17-jre-
tag-latest: true
extra-tags: ", ghcr.io/${{ github.repository }}:jre-11"
- alias: jre-11-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre-alpine/Dockerfile
tag-prefix: eclipse-temurin-11-jre-alpine-
extra-tags: ", ghcr.io/${{ github.repository }}:jre-17"
- alias: jre-17-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre-alpine/Dockerfile
tag-prefix: eclipse-temurin-17-jre-alpine-
tag-latest: false
extra-tags: ", ghcr.io/${{ github.repository }}:alpine, ghcr.io/${{ github.repository }}:jre-11-alpine"
extra-tags: ", ghcr.io/${{ github.repository }}:alpine, ghcr.io/${{ github.repository }}:jre-17-alpine"
needs:
- build-maven
- build-docker
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/publish-release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
- name: Set version
id: set-version
Expand Down Expand Up @@ -55,14 +55,14 @@ jobs:
fail-fast: false
matrix:
include:
- alias: jre-11
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile
tag-prefix: eclipse-temurin-11-jre-
extra-tags--pattern: ", ghcr.io/${{ github.repository }}:jre-11-$RELEASE_VERSION"
- alias: jre-11-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-11-jre-alpine/Dockerfile
tag-prefix: eclipse-temurin-11-jre-alpine-
extra-tags-pattern: ", ghcr.io/${{ github.repository }}:alpine-$RELEASE_VERSION, ghcr.io/${{ github.repository }}:jre-11-alpine-$RELEASE_VERSION"
- alias: jre-17
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile
tag-prefix: eclipse-temurin-17-jre-
extra-tags--pattern: ", ghcr.io/${{ github.repository }}:jre-17-$RELEASE_VERSION"
- alias: jre-17-alpine
dockerfile: packaging/docker/unix/eclipse-temurin-17-jre-alpine/Dockerfile
tag-prefix: eclipse-temurin-17-jre-alpine-
extra-tags-pattern: ", ghcr.io/${{ github.repository }}:alpine-$RELEASE_VERSION, ghcr.io/${{ github.repository }}:jre-17-alpine-$RELEASE_VERSION"
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.2</version>
<version>1.8</version>
</extension>
</extensions>
4 changes: 2 additions & 2 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ This will generate an assembly artifact through the `appassembler-maven-plugin`

This repository includes the base image which can be built simply as...

docker build -t jenkins4eval/jenkinsfile-runner -f packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile .
docker build -t jenkins4eval/jenkinsfile-runner -f packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile .

During development you can reuse the local machine build instead of doing a full build from scratch

docker build -t jenkins4eval/jenkinsfile-runner:dev -f packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile-dev-vanilla .
docker build -t jenkins4eval/jenkinsfile-runner:dev -f packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile-dev-vanilla .

== Debugging

Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Map branches = [:]
for (int i = 0; i < platforms.size(); ++i) {
String label = platforms[i]
branches[label] = {
node(label + " && docker") {
node("maven-17") {
timestamps {
ws("platform_${label}_${branchName}_${buildNumber}") {
stage('Checkout') {
Expand All @@ -25,7 +25,7 @@ for (int i = 0; i < platforms.size(); ++i) {

stage('Build') {
timeout(60) {
infra.runMaven(['clean', 'install', '-Dset.changelist', '-Dmaven.test.failure.ignore=true', '-Denvironment=test', '-Ppackage-app,package-vanilla,jacoco,run-its'], '11')
infra.runMaven(['clean', 'install', '-Dset.changelist', '-Dmaven.test.failure.ignore=true', '-Denvironment=test', '-Ppackage-app,package-vanilla,jacoco,run-its', '--add-opens=java.base/java.util=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', '--add-opens=java.base/java.lang.invoke=ALL-UNNAMED'], '17')
}
}

Expand Down
1 change: 1 addition & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<goal>assemble</goal>
</goals>
<configuration>
<extraJvmArguments>--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED</extraJvmArguments>
<programs>
<program>
<id>jenkinsfile-runner</id>
Expand Down
4 changes: 2 additions & 2 deletions packaging-parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<version>3.7.1</version>
<configuration>
<skipAssembly>${jfr.packaging.skip.assembly}</skipAssembly>
<!-- Disabled due to https://github.com/jenkinsci/jenkinsfile-runner/issues/350
Expand Down Expand Up @@ -230,7 +230,7 @@
</goals>
<configuration>
<!--TODO: Add option to skip this step -->
<minimumJavaVersion>8</minimumJavaVersion>
<minimumJavaVersion>11</minimumJavaVersion>
<jenkinsCoreVersionOverride>${jenkins.version}</jenkinsCoreVersionOverride>
<outputDirectory>${project.build.directory}/plugins</outputDirectory>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion packaging-slim-parent-pom/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The parent POM prepares the following artifacts in `target`:

== Usage in Docker

See link:../packaging/docker/unix/eclipse-temurin-11-jre/Dockerfile-dev-slim[Dockerfile-dev-slim] for example.
See link:../packaging/docker/unix/eclipse-temurin-17-jre/Dockerfile-dev-slim[Dockerfile-dev-slim] for example.
This example also uses additional optimization tricks.

== Status
Expand Down
2 changes: 1 addition & 1 deletion packaging-slim-parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</goals>
<configuration>
<!--TODO: Add option to skip this step -->
<minimumJavaVersion>8</minimumJavaVersion>
<minimumJavaVersion>11</minimumJavaVersion>
<jenkinsCoreVersionOverride>${jenkins.version}</jenkinsCoreVersionOverride>
<outputDirectory>${project.build.directory}/plugins</outputDirectory>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions packaging/docker/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ The following format is used:
${JVM_VENDOR}-${JAVA_VERSION}[-${JVM_CLASSIFIER1}][-${JVM_CLASSIFIER2}]...[-${OS}]
----

Examples: `eclipse-temurin-11-jre`, `eclipse-temurin-11-jre-alpine`
Examples: `eclipse-temurin-17-jre`, `eclipse-temurin-17-jre-alpine`

* `JVM_VENDOR` - source of the JVM in lowercase, e.g. Eclipse Temurin.
* `JAVA_VERSION` - version of the JVM.
Right now `11` are used, fine-grain versions might be added in the future.
Right now `17` are used, fine-grain versions might be added in the future.
* `JVM_CLASSIFIER` - Additional information about the JVM used in the image.
It might refer to `jdk`/`jre` or a JVM type (e.g. `jre-alpine`, `openj9`).
Multiple classifiers might be used.
Expand Down
2 changes: 1 addition & 1 deletion packaging/docker/build-mvncache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.8.6-eclipse-temurin-11
FROM maven:3.9.9-eclipse-temurin-17-focal
WORKDIR /src
ENV MAVEN_OPTS=-Dmaven.repo.local=/mavenrepo
ADD . /src
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM jenkins/jenkinsfile-runner:build-mvncache as jenkinsfilerunner-mvncache

FROM maven:3.8.6-eclipse-temurin-11 as jenkinsfilerunner-build
FROM maven:3.9.9-eclipse-temurin-17-focal as jenkinsfilerunner-build
RUN apt-get update && apt-get install -y unzip
ENV MAVEN_OPTS=-Dmaven.repo.local=/mavenrepo
COPY --from=jenkinsfilerunner-mvncache /mavenrepo /mavenrepo
Expand All @@ -14,22 +14,19 @@ ADD packaging-parent-resources /jenkinsfile-runner/packaging-parent-resources
ADD packaging-parent-pom /jenkinsfile-runner/packaging-parent-pom
ADD packaging-slim-parent-pom /jenkinsfile-runner/packaging-slim-parent-pom
ADD pom.xml /jenkinsfile-runner/pom.xml
RUN cd /jenkinsfile-runner && mvn clean package --batch-mode -ntp --show-version --errors
ADD .git /jenkinsfile-runner/.git
RUN cd /jenkinsfile-runner && mvn clean package --batch-mode -ntp --show-version --errors -DargLine="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED"

# Prepare the Jenkins core
RUN mkdir /app && unzip /jenkinsfile-runner/vanilla-package/target/war/jenkins.war -d /app/jenkins && \
rm -rf /app/jenkins/scripts /app/jenkins/jsbundles /app/jenkins/css /app/jenkins/images /app/jenkins/help /app/jenkins/WEB-INF/detached-plugins /app/jenkins/WEB-INF/jenkins-cli.jar /app/jenkins/WEB-INF/lib/jna-4.5.2.jar \
# Delete HPI files and use the archive directories instead
RUN echo "Optimizing plugins..." && \
cd /jenkinsfile-runner/vanilla-package/target/plugins && \
rm -rf *.hpi && \
for f in * ; do echo "Exploding $f..." && mv "$f" "$f.hpi" ; done;
rm -rf /app/jenkins/scripts /app/jenkins/jsbundles /app/jenkins/css /app/jenkins/images /app/jenkins/help /app/jenkins/WEB-INF/detached-plugins /app/jenkins/WEB-INF/jenkins-cli.jar /app/jenkins/WEB-INF/lib/jna-4.5.2.jar

FROM eclipse-temurin:11.0.18_10-jre-alpine
FROM eclipse-temurin:17-jre-alpine
ENV JENKINS_UC https://updates.jenkins.io
ENV CASC_JENKINS_CONFIG /usr/share/jenkins/ref/casc
ENV JENKINS_PM_VERSION 2.5.0
ENV JENKINS_PM_VERSION 2.13.2
ENV JENKINS_PM_URL https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/${JENKINS_PM_VERSION}/jenkins-plugin-manager-${JENKINS_PM_VERSION}.jar
ENV JDK_17 true

USER root
RUN apk add --update --no-cache wget git \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM jenkins/jenkinsfile-runner:build-mvncache as jenkinsfilerunner-mvncache

FROM maven:3.8.6-eclipse-temurin-11 as jenkinsfilerunner-build
FROM maven:3.9.9-eclipse-temurin-17-focal as jenkinsfilerunner-build
RUN apt-get update && apt-get install -y unzip
ENV MAVEN_OPTS=-Dmaven.repo.local=/mavenrepo
COPY --from=jenkinsfilerunner-mvncache /mavenrepo /mavenrepo
Expand All @@ -14,24 +14,20 @@ ADD packaging-parent-resources /jenkinsfile-runner/packaging-parent-resources
ADD packaging-parent-pom /jenkinsfile-runner/packaging-parent-pom
ADD packaging-slim-parent-pom /jenkinsfile-runner/packaging-slim-parent-pom
ADD pom.xml /jenkinsfile-runner/pom.xml
RUN cd /jenkinsfile-runner && mvn clean package --batch-mode -ntp --show-version --errors
ADD .git /jenkinsfile-runner/.git
RUN cd /jenkinsfile-runner && mvn clean package --batch-mode -ntp --show-version --errors -DargLine="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
# Prepare the Jenkins core
RUN mkdir /app && unzip /jenkinsfile-runner/vanilla-package/target/war/jenkins.war -d /app/jenkins && \
rm -rf /app/jenkins/scripts /app/jenkins/jsbundles /app/jenkins/css /app/jenkins/images /app/jenkins/help /app/jenkins/WEB-INF/detached-plugins /app/jenkins/WEB-INF/jenkins-cli.jar /app/jenkins/WEB-INF/lib/jna-4.5.2.jar \
# Delete HPI files and use the archive directories instead
RUN echo "Optimizing plugins..." && \
cd /jenkinsfile-runner/vanilla-package/target/plugins && \
rm -rf *.hpi && \
for f in * ; do echo "Exploding $f..." && mv "$f" "$f.hpi" ; done;

FROM eclipse-temurin:11.0.18_10-jre
rm -rf /app/jenkins/scripts /app/jenkins/jsbundles /app/jenkins/css /app/jenkins/images /app/jenkins/help /app/jenkins/WEB-INF/detached-plugins /app/jenkins/WEB-INF/jenkins-cli.jar /app/jenkins/WEB-INF/lib/jna-4.5.2.jar

FROM eclipse-temurin:17-jre
RUN apt-get update && apt-get install wget && rm -rf /var/lib/apt/lists/*

ENV JDK_11 true
ENV JDK_17 true

ENV JENKINS_UC https://updates.jenkins.io
ENV CASC_JENKINS_CONFIG /usr/share/jenkins/ref/casc
ENV JENKINS_PM_VERSION 2.5.0
ENV JENKINS_PM_VERSION 2.13.2
ENV JENKINS_PM_URL https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/${JENKINS_PM_VERSION}/jenkins-plugin-manager-${JENKINS_PM_VERSION}.jar

USER root
Expand Down
3 changes: 3 additions & 0 deletions packaging/docker/unix/jenkinsfile-runner-launcher
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fi
if [ -n "$JDK_11" ] ; then
export JAVA_OPTS="--illegal-access=permit $JAVA_OPTS"
fi
if [ -n "$JDK_17" ] ; then
export JAVA_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED $JAVA_OPTS"
fi

# check if the user has provided a path to the file
if [ -z "${JENKINSFILE_PATH}" ] ; then
Expand Down
6 changes: 6 additions & 0 deletions payload-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<exclusions>
<exclusion>
<groupId>io.jenkins.plugins</groupId>
<artifactId>asm-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.jenkins</groupId>
Expand Down
15 changes: 13 additions & 2 deletions payload/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<groupId>org.jenkins-ci</groupId>
<artifactId>symbol-annotation</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>pipeline-as-yaml</artifactId>
Expand All @@ -53,12 +58,18 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<version>2.11.0</version>
<exclusions>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>templating-engine</artifactId>
<version>2.3</version>
<version>2.5.3</version>
<optional>true</optional>
<exclusions>
<exclusion>
Expand Down
Loading
Loading