Skip to content

Commit 303524c

Browse files
committed
Merge branch 'weekly' into weekly-with-plugins
2 parents bb7ee9b + 22dbc66 commit 303524c

24 files changed

+526
-237
lines changed

.ci/publish.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -eu -o pipefail
1111

1212
: "${DOCKERHUB_ORGANISATION:=jenkins}"
1313
: "${DOCKERHUB_REPO:=jenkins}"
14+
: "${BAKE_TARGET:=linux}"
1415

1516
export JENKINS_REPO="${DOCKERHUB_ORGANISATION}/${DOCKERHUB_REPO}"
1617

@@ -76,15 +77,22 @@ else
7677
fi
7778

7879
build_opts=("--pull")
80+
metadata_suffix="publish"
7981
if test "${dry_run}" == "true"; then
80-
build_opts+=("--load")
82+
build_opts+=("--set=*.output=type=cacheonly")
83+
metadata_suffix="dry-run"
8184
else
8285
build_opts+=("--push")
8386
fi
8487

88+
# Save build result metadata
89+
mkdir -p target
90+
BUILD_METADATA_PATH="target/build-result-metadata_${BAKE_TARGET}_${metadata_suffix}.json"
91+
build_opts+=("--metadata-file=${BUILD_METADATA_PATH}")
92+
8593
WAR_SHA="$(curl --disable --fail --silent --show-error --location "https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war.sha256")"
8694
COMMIT_SHA=$(git rev-parse HEAD)
87-
export COMMIT_SHA JENKINS_VERSION WAR_SHA LATEST_WEEKLY LATEST_LTS
95+
export COMMIT_SHA JENKINS_VERSION WAR_SHA LATEST_WEEKLY LATEST_LTS BUILD_METADATA_PATH
8896

8997
cat <<EOF
9098
Using the following settings:
@@ -94,6 +102,13 @@ Using the following settings:
94102
* COMMIT_SHA: ${COMMIT_SHA}
95103
* LATEST_WEEKLY: ${LATEST_WEEKLY}
96104
* LATEST_LTS: ${LATEST_LTS}
105+
* BUILD_METADATA_PATH: ${BUILD_METADATA_PATH}
106+
* BAKE_TARGET: ${BAKE_TARGET}
107+
* BAKE OPTIONS:
108+
$(printf ' %s\n' "${build_opts[@]}")
109+
110+
* RESOLVED BAKE CONFIG:
111+
$(docker buildx bake --file docker-bake.hcl --print "${BAKE_TARGET}")
97112
EOF
98113

99-
docker buildx bake --file docker-bake.hcl "${build_opts[@]}" linux
114+
docker buildx bake --file docker-bake.hcl "${build_opts[@]}" "${BAKE_TARGET}"

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ updates:
1818

1919
# Debian Linux
2020

21-
- package-ecosystem: docker
22-
directory: "debian"
23-
schedule:
24-
interval: weekly
25-
open-pull-requests-limit: 2
26-
target-branch: master
27-
labels:
28-
- dependencies
29-
ignore:
30-
# Ignore proposals to update to new versions of Java because updatecli takes care of that.
31-
- dependency-name: "eclipse-temurin"
32-
3321
- package-ecosystem: docker
3422
directory: "debian"
3523
schedule:

.github/workflows/updatecli.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v6
1717

1818
- name: Install Updatecli in the runner
19-
uses: updatecli/updatecli-action@v2.98.0
19+
uses: updatecli/updatecli-action@v2.99.0
2020

2121
- name: Run Updatecli in Dry Run mode
2222
run: updatecli diff --config ./updatecli/updatecli.d --values ./updatecli/values.github-action.yaml

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ work-pester-jenkins-windows/
1717
/**/windows/**/jenkins-plugin-cli.ps1
1818
/**/windows/**/jenkins-support.psm1
1919

20+
build-windows_*.yaml
21+
2022
tests/**/Dockerfile\.*
2123

2224
/__pycache__/

HACKING.adoc

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,116 @@ In order to debug the controller, use the `-e DEBUG=true -p 5005:5005` when star
149149
Jenkins will be suspended on the startup in such case,
150150
and then it will be possible to attach a debugger from IDE to it.
151151

152-
== Test the publishing using an overridden target repository on Docker Hub
152+
== Test images publication
153153

154-
Create a new dedicated target repository in your Docker Hub account, and use it like follows:
154+
You can test the script used for publication in dry-run by setting an existing Jenkins Core version and by passing the `-n` option:
155155

156156
[source,bash]
157157
--
158-
export DOCKERHUB_ORGANISATION=batmat
159-
export DOCKERHUB_REPO=test-jenkins
158+
$ export JENKINS_VERSION=2.528.3
159+
$ ./.ci/publish.sh -n
160+
Dry run, will not publish images
161+
Using the following settings:
162+
* JENKINS_REPO: jenkins/jenkins
163+
* JENKINS_VERSION: 2.528.3
164+
* WAR_SHA: bfa31f1e3aacebb5bce3d5076c73df97bf0c0567eeb8d8738f54f6bac48abd74
165+
* COMMIT_SHA: 1c72a9383191562eb3c44838aeeadad0839c2c92
166+
* LATEST_WEEKLY: false
167+
* LATEST_LTS: true
168+
* BUILD_METADATA_PATH: target/build-result-metadata_linux_dry-run.json
169+
[+] Building 104.6s (59/73)
170+
<...snip...>
171+
--
172+
173+
Note that if you can set `BAKE_TARGET` to test the publication of a single target instead the default "linux" multiarch (heavy) build:
174+
175+
[source,bash]
176+
--
177+
$ export BAKE_TARGET=debiand_jdk25
178+
$ ./.ci/publish.sh -n
179+
Using the following settings:
180+
* JENKINS_REPO: jenkins/jenkins
181+
* JENKINS_VERSION: 2.528.3
182+
* WAR_SHA: bfa31f1e3aacebb5bce3d5076c73df97bf0c0567eeb8d8738f54f6bac48abd74
183+
* COMMIT_SHA: aaf4e7faf887b7ac4879c3bf540ede48220cca9f
184+
* LATEST_WEEKLY: false
185+
* LATEST_LTS: true
186+
* BUILD_METADATA_PATH: target/build-result-metadata_debian_jdk25_dry-run.json
187+
* BAKE TARGET: debian_jdk25
188+
* BUILDX OPTIONS:
189+
--pull
190+
--set=*.output=type=cacheonly
191+
--metadata-file=target/build-result-metadata_debian_jdk25_dry-run.json
192+
193+
* RESOLVED BAKE CONFIG:
194+
{
195+
"group": {
196+
"default": {
197+
"targets": [
198+
"debian_jdk25"
199+
]
200+
}
201+
},
202+
"target": {
203+
"debian_jdk25": {
204+
"context": ".",
205+
"dockerfile": "debian/Dockerfile",
206+
"args": {
207+
"COMMIT_SHA": "aaf4e7faf887b7ac4879c3bf540ede48220cca9f",
208+
"DEBIAN_RELEASE_LINE": "trixie",
209+
"DEBIAN_VARIANT": "",
210+
"DEBIAN_VERSION": "20251117",
211+
"JAVA_VERSION": "25.0.1_8",
212+
"JENKINS_VERSION": "2.528.3",
213+
"PLUGIN_CLI_VERSION": "2.13.2",
214+
"WAR_SHA": "bfa31f1e3aacebb5bce3d5076c73df97bf0c0567eeb8d8738f54f6bac48abd74",
215+
"WAR_URL": "https://get.jenkins.io/war-stable/2.528.3/jenkins.war"
216+
},
217+
"tags": [
218+
"docker.io/jenkins/jenkins:2.528.3-jdk25",
219+
"docker.io/jenkins/jenkins:lts-jdk25",
220+
"docker.io/jenkins/jenkins:2.528.3-lts-jdk25"
221+
],
222+
"platforms": [
223+
"linux/amd64",
224+
"linux/arm64",
225+
"linux/s390x",
226+
"linux/ppc64le"
227+
]
228+
}
229+
}
230+
}
231+
[+] Building 104.6s (59/73)
232+
...
233+
--
234+
235+
You can also pass the `-d` option (debug) to see traces from the script.
236+
237+
=== Using an overridden target repository on Docker Hub
238+
239+
Create a new dedicated target repository in your Docker Hub account, and use it like follows (note the absence of `-d` option):
240+
241+
[source,bash]
242+
--
243+
$ export DOCKERHUB_ORGANISATION=jenkins4eval
244+
$ export DOCKERHUB_REPO=test-jenkins
160245
# The log below will help confirm this override was taken in account:
161-
./publish.sh
162-
Docker repository in Use:
163-
* JENKINS_REPO: batmat/test-jenkins
246+
$ ./.ci/publish.sh
247+
Using the following settings:
248+
* JENKINS_REPO: jenkins4eval/test-jenkins
249+
* JENKINS_VERSION: 2.528.3
250+
* WAR_SHA: bfa31f1e3aacebb5bce3d5076c73df97bf0c0567eeb8d8738f54f6bac48abd74
251+
* COMMIT_SHA: aaf4e7faf887b7ac4879c3bf540ede48220cca9f
252+
* LATEST_WEEKLY: false
253+
* LATEST_LTS: true
254+
* BUILD_METADATA_PATH: target/build-result-metadata_linux_publish.json
255+
* BAKE TARGET: linux
256+
* BUILDX OPTIONS:
257+
--pull
258+
--push
259+
--metadata-file=target/build-result-metadata_linux_publish.json
260+
261+
* RESOLVED BAKE CONFIG:
262+
{
164263
...
165264
--

Jenkinsfile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ stage('Build') {
4747
withEnv(envVars) {
4848
echo '= bake target: linux'
4949

50-
def windowsImageTypes = ['windowsservercore-ltsc2022']
50+
def windowsImageTypes = [
51+
'windowsservercore-ltsc2019',
52+
'windowsservercore-ltsc2022'
53+
]
5154
for (anImageType in windowsImageTypes) {
5255
def imageType = anImageType
5356
builds[imageType] = {
54-
nodeWithTimeout('windows-2022') {
57+
def windowsVersionNumber = imageType.split('-')[1].replace('ltsc', '')
58+
def windowsLabel = "windows-${windowsVersionNumber}"
59+
nodeWithTimeout(windowsLabel) {
5560
stage('Checkout') {
5661
checkout scm
5762
}
@@ -63,13 +68,14 @@ stage('Build') {
6368
*/
6469
stage("Build ${imageType}") {
6570
infra.withDockerCredentials {
66-
powershell './make.ps1 build'
71+
powershell './make.ps1 build -ImageType ${env:IMAGE_TYPE}'
72+
archiveArtifacts artifacts: 'build-windows_*.yaml', allowEmptyArchive: true
6773
}
6874
}
6975

7076
stage("Test ${imageType}") {
7177
infra.withDockerCredentials {
72-
def windowsTestStatus = powershell(script: './make.ps1 test', returnStatus: true)
78+
def windowsTestStatus = powershell(script: './make.ps1 test -ImageType ${env:IMAGE_TYPE}', returnStatus: true)
7379
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'target/**/junit-results.xml')
7480
if (windowsTestStatus > 0) {
7581
// If something bad happened let's clean up the docker images
@@ -102,8 +108,8 @@ stage('Build') {
102108
stage('Publish') {
103109
infra.withDockerCredentials {
104110
withEnv(['DOCKERHUB_ORGANISATION=jenkins', 'DOCKERHUB_REPO=jenkins']) {
105-
powershell './make.ps1 build'
106-
powershell './make.ps1 publish'
111+
powershell './make.ps1 build -ImageType ${env:IMAGE_TYPE}'
112+
powershell './make.ps1 publish -ImageType ${env:IMAGE_TYPE}'
107113
}
108114
}
109115
}
@@ -116,8 +122,7 @@ stage('Build') {
116122
}
117123

118124
if (!infra.isTrusted()) {
119-
// This list can be updated with the following command:
120-
// make show | jq -r '.target | keys[]' | sort
125+
// An up to date list can be obtained with make list-linux
121126
def images = [
122127
'alpine_jdk21',
123128
'alpine_jdk25',
@@ -149,6 +154,7 @@ stage('Build') {
149154
stage("Build linux-${imageToBuild}") {
150155
infra.withDockerCredentials {
151156
sh "make build-${imageToBuild}"
157+
archiveArtifacts artifacts: 'target/build-result-metadata_*.json', allowEmptyArchive: true
152158
}
153159
}
154160

@@ -178,7 +184,8 @@ stage('Build') {
178184
// sanity check that proves all images build on declared platforms not already built in other stages
179185
stage("Multi arch build - ${architecture}") {
180186
infra.withDockerCredentials {
181-
sh "make docker-init listarch-${architecture} buildarch-${architecture}"
187+
sh "make docker-init buildarch-${architecture}"
188+
archiveArtifacts artifacts: 'target/build-result-metadata_*.json', allowEmptyArchive: true
182189
}
183190
}
184191
}
@@ -206,6 +213,7 @@ stage('Build') {
206213
infra.withDockerCredentials {
207214
sh 'make docker-init'
208215
sh 'make publish'
216+
archiveArtifacts artifacts: 'target/build-result-metadata_*.json', allowEmptyArchive: true
209217
}
210218
}
211219
}

0 commit comments

Comments
 (0)