Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a2a685b
reoder target args for uniformity (distrib specific at the end)
lemeurherve Jan 9, 2026
8e63786
chore(windows): use docker bake to generate the docker compose file
lemeurherve Jan 9, 2026
702f00b
temporary hardcode windows target to jdk21 & jdk25, to be reverted in…
lemeurherve Jan 9, 2026
be45922
update golden tags accordingly
lemeurherve Jan 9, 2026
22b2998
remove jdk17 from golden tags after rebase
lemeurherve Jan 14, 2026
353058d
feat: allow to build different Windows versions depending on Jenkins …
lemeurherve Jan 14, 2026
86a9810
update golden tags, now including full windows version
lemeurherve Jan 14, 2026
bc58d88
apply own suggestion review
lemeurherve Jan 14, 2026
4fdeea9
restore jdks_to_build in windows target
lemeurherve Jan 14, 2026
a72c0f8
restore LTS windows jdk17 tags in golden file
lemeurherve Jan 14, 2026
825f3b9
agent label from windows image type
lemeurherve Jan 16, 2026
90108a8
Merge branch 'master' into windows-use-docker-bake_2026-01-08
lemeurherve Jan 16, 2026
8a2ee8f
update golden files
lemeurherve Jan 16, 2026
6206249
restore default 2.534 (?)
lemeurherve Jan 16, 2026
4e1f78b
merge upstream/master
lemeurherve Jan 17, 2026
31027a7
allow to override OS
lemeurherve Jan 17, 2026
688ded2
add list-% target
lemeurherve Jan 17, 2026
5b9f1be
Merge branch 'master' into windows-use-docker-bake_2026-01-08
lemeurherve Jan 17, 2026
ac5cd6f
add list-% target
lemeurherve Jan 17, 2026
4d0205e
Revert "restore default 2.534 (?)"
lemeurherve Jan 17, 2026
bce7962
Reapply "restore default 2.534 (?)"
lemeurherve Jan 17, 2026
0681ad2
try next weekly https://github.com/jenkinsci/jenkins/releases/tag/jen…
lemeurherve Jan 17, 2026
8f1f417
try https://github.com/jenkinsci/jenkins/releases/tag/jenkins-2.545
lemeurherve Jan 17, 2026
fd06d3b
Revert "try https://github.com/jenkinsci/jenkins/releases/tag/jenkins…
lemeurherve Jan 17, 2026
1bb3a5e
Revert "try next weekly https://github.com/jenkinsci/jenkins/releases…
lemeurherve Jan 17, 2026
0c74d3f
Merge branch 'master' into windows-use-docker-bake_2026-01-08
lemeurherve Jan 17, 2026
a0df9f8
less fragile conversion
lemeurherve Jan 17, 2026
57a8339
yq --version as sanity check (not the same behavior between ci.j.io &…
lemeurherve Jan 17, 2026
c7bdc56
multiline command
lemeurherve Jan 17, 2026
fbf01fc
specify `yq` input and output format to avoid any ambiguity and error
lemeurherve Jan 17, 2026
e7ecd2e
quotes around yq queries
lemeurherve Jan 17, 2026
9329237
use pwsh instead of powershell to use recent powershell and proper ex…
lemeurherve Jan 17, 2026
72cd115
pass image type to make.ps1
lemeurherve Jan 17, 2026
b4611bb
test: build both Windows 2019 and 2022 images
lemeurherve Jan 17, 2026
12c87a6
Revert "use pwsh instead of powershell to use recent powershell and p…
lemeurherve Jan 17, 2026
83f6a93
restore backslashes in yq queries
lemeurherve Jan 17, 2026
cc9a70c
Revert "test: build both Windows 2019 and 2022 images"
lemeurherve Jan 17, 2026
62bc27d
don't hardcode windows version in tests_helpers's `Build-Docker` func…
lemeurherve Jan 17, 2026
f5baabd
test: build both Windows 2019 and 2022 images and show the differenci…
lemeurherve Jan 17, 2026
bb2a99e
Revert "test: build both Windows 2019 and 2022 images and show the di…
lemeurherve Jan 17, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ work-pester-jenkins-windows/
/**/windows/**/jenkins-plugin-cli.ps1
/**/windows/**/jenkins-support.psm1

build-windows_*.yaml

tests/**/Dockerfile\.*
20 changes: 12 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ stage('Build') {
withEnv(envVars) {
echo '= bake target: linux'

def windowsImageTypes = ['windowsservercore-ltsc2022']
def windowsImageTypes = [
'windowsservercore-ltsc2022'
]
for (anImageType in windowsImageTypes) {
def imageType = anImageType
builds[imageType] = {
nodeWithTimeout('windows-2022') {
def windowsVersionNumber = imageType.split('-')[1].replace('ltsc', '')
def windowsLabel = "windows-${windowsVersionNumber}"
nodeWithTimeout(windowsLabel) {
stage('Checkout') {
checkout scm
}
Expand All @@ -63,13 +67,14 @@ stage('Build') {
*/
stage("Build ${imageType}") {
infra.withDockerCredentials {
powershell './make.ps1 build'
powershell './make.ps1 build -ImageType ${env:IMAGE_TYPE}'
archiveArtifacts artifacts: 'build-windows_*.yaml', allowEmptyArchive: true
}
}

stage("Test ${imageType}") {
infra.withDockerCredentials {
def windowsTestStatus = powershell(script: './make.ps1 test', returnStatus: true)
def windowsTestStatus = powershell(script: './make.ps1 test -ImageType ${env:IMAGE_TYPE}', returnStatus: true)
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'target/**/junit-results.xml')
if (windowsTestStatus > 0) {
// If something bad happened let's clean up the docker images
Expand Down Expand Up @@ -102,8 +107,8 @@ stage('Build') {
stage('Publish') {
infra.withDockerCredentials {
withEnv(['DOCKERHUB_ORGANISATION=jenkins', 'DOCKERHUB_REPO=jenkins']) {
powershell './make.ps1 build'
powershell './make.ps1 publish'
powershell './make.ps1 build -ImageType ${env:IMAGE_TYPE}'
powershell './make.ps1 publish -ImageType ${env:IMAGE_TYPE}'
}
}
}
Expand All @@ -116,8 +121,7 @@ stage('Build') {
}

if (!infra.isTrusted()) {
// This list can be updated with the following command:
// make show | jq -r '.target | keys[]' | sort
// An up to date list can be obtained with make list-linux
def images = [
'alpine_jdk21',
'alpine_jdk25',
Expand Down
52 changes: 37 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ export BUILDKIT_PROGRESS=plain
## Required to have the commit SHA added as a Docker image label
export COMMIT_SHA=$(shell git rev-parse HEAD)

current_os := $(shell uname -s)
current_arch := $(shell uname -m)

export OS ?= $(shell \
case "$(current_os)" in \
(Linux) echo linux ;; \
(Darwin) echo linux ;; \
(MINGW*|MSYS*|CYGWIN*) echo windows ;; \
(*) echo unknown ;; \
esac)

export ARCH ?= $(shell \
case $(current_arch) in \
(x86_64) echo "amd64" ;; \
Expand All @@ -31,11 +41,11 @@ TEST_SUITES ?= $(CURDIR)/tests
## Check the presence of a CLI in the current PATH
check_cli = type "$(1)" >/dev/null 2>&1 || { echo "Error: command '$(1)' required but not found. Exiting." ; exit 1 ; }
## Check if a given image exists in the current manifest docker-bake.hcl
check_image = make --silent list | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image '$(1)' does not exist in manifest for the platform 'linux/$(ARCH)'. Please check the output of 'make list'. Exiting." ; exit 1 ; }
check_image = make --silent list | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image '$(1)' does not exist in manifest for the current platform '$(OS)/$(ARCH)'. Please check the output of 'make list'. Exiting." ; exit 1 ; }
## Base "docker buildx base" command to be reused everywhere
bake_base_cli := docker buildx bake -f docker-bake.hcl --load
## Default bake target
bake_default_target := linux
bake_default_target := all

check-reqs:
## Build requirements
Expand Down Expand Up @@ -72,44 +82,56 @@ hadolint:
shellcheck:
@$(ROOT_DIR)/tools/shellcheck -e SC1091 jenkins-support *.sh tests/test_helpers.bash tools/hadolint tools/shellcheck .ci/publish.sh

# Build targets depending on the current architecture
# Build all targets with the current OS and architecture
build: check-reqs target
@set -x; $(bake_base_cli) --metadata-file=target/build-result-metadata_$(bake_default_target).json --set '*.platform=linux/$(ARCH)' $(shell make --silent list)
@set -x; $(bake_base_cli) --metadata-file=target/build-result-metadata_$(bake_default_target).json --set '*.platform=$(OS)/$(ARCH)' $(shell make --silent list)

# Build targets depending on the architecture
# Build targets depending on the architecture (Linux only, no multiarch for Windows)
buildarch-%: check-reqs target showarch-%
@set -x; $(bake_base_cli) --metadata-file=target/build-result-metadata_$*.json --set '*.platform=linux/$*' $(shell make --silent listarch-$*)

# Build a specific target with the current architecture
# Build a specific target with the current OS and architecture
build-%: check-reqs target show-%
@$(call check_image,$*)
@set -x; $(bake_base_cli) --metadata-file=target/build-result-metadata_$*.json --set '*.platform=linux/$(ARCH)' '$*'
@set -x; $(bake_base_cli) --metadata-file=target/build-result-metadata_$*.json --set '*.platform=$(OS)/$(ARCH)' '$*'

# Show all targets
show:
@set -x; make --silent show-$(bake_default_target)

# Show a specific target
show-%:
@set -x; $(bake_base_cli) --progress=quiet $* --print | jq
@set -x; $(bake_base_cli) --progress=quiet '$*' --print | jq

# Show all targets depending on the architecture
showarch-%:
@set -x; make --silent show | jq --arg arch "linux/$*" '.target |= with_entries(select(.value.platforms | index($$arch)))'
@set -x; make --silent show | jq --arg arch "$(OS)/$*" '.target |= with_entries(select(.value.platforms | index($$arch)))'

# List all tags
# List tags of all targets
tags:
@set -x; make show | jq -r ' .target | to_entries[] | .key as $$name | .value.tags[] | "\(.) (\($$name))"' | LC_ALL=C sort -u
@set -x; make tags-$(bake_default_target)

# List tags of a specific target
tags-%:
@set -x; make show-$* | jq -r ' .target | to_entries[] | .key as $$name | .value.tags[] | "\(.) (\($$name))"' | LC_ALL=C sort -u

# List all platforms
platforms:
@set -x; make show | jq -r ' .target | to_entries[] | .key as $$name | .value.platforms[] | "\($$name):\(.)"' | LC_ALL=C sort -u
@set -x; make platforms-$(bake_default_target)

# List platforms of a specific target
platforms-%:
@set -x; make show-$* | jq -r ' .target | to_entries[] | .key as $$name | .value.platforms[] | "\($$name):\(.)"' | LC_ALL=C sort -u

# Return the list of targets depending on the current architecture
# Return the list of targets depending on the current OS and architecture
list: check-reqs
@set -x; make --silent showarch-$(ARCH) | jq -r '.target | keys[]'
@set -x; make --silent listarch-$(ARCH)

# Return the list of targets of a specific "target" (can be a docker bake group)
list-%: check-reqs
@set -x; make --silent show-$* | jq -r '.target | keys[]'

# Return the list of targets depending on the architecture
# Return the list of targets depending on the architecture (Linux only, no multiarch for Windows)
listarch-%: check-reqs
@set -x; make --silent showarch-$* | jq -r '.target | keys[]'

Expand Down
35 changes: 0 additions & 35 deletions build-windows.yaml

This file was deleted.

83 changes: 80 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ variable "jdks_to_build_for_weekly" {
default = [21, 25]
}

variable "windows_version_to_build_for_lts" {
default = ["windowsservercore-ltsc2019"]
}

variable "windows_version_to_build_for_weekly" {
default = ["windowsservercore-ltsc2022"]
}

variable "default_jdk" {
default = 21
}
Expand Down Expand Up @@ -83,6 +91,11 @@ variable "RHEL_RELEASE_LINE" {
default = "ubi9"
}

# Set this value to a specific Windows version to override Windows versions to build returned by windowsversions function
variable "WINDOWS_VERSION_OVERRIDE" {
default = ""
}

## Internal variables
variable "jdk_versions" {
default = {
Expand Down Expand Up @@ -114,8 +127,8 @@ target "alpine" {
WAR_URL = war_url()
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
ALPINE_TAG = ALPINE_FULL_TAG
JAVA_VERSION = javaversion(jdk)
ALPINE_TAG = ALPINE_FULL_TAG
}
tags = linux_tags("alpine", jdk)
platforms = platforms("alpine", jdk)
Expand All @@ -135,10 +148,10 @@ target "debian" {
WAR_URL = war_url()
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
JAVA_VERSION = javaversion(jdk)
DEBIAN_RELEASE_LINE = DEBIAN_RELEASE_LINE
DEBIAN_VERSION = DEBIAN_VERSION
DEBIAN_VARIANT = is_debian_slim(variant) ? "-slim" : ""
JAVA_VERSION = javaversion(jdk)
}
tags = linux_tags(variant, jdk)
platforms = platforms(variant, jdk)
Expand All @@ -157,14 +170,36 @@ target "rhel" {
WAR_URL = war_url()
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
JAVA_VERSION = javaversion(jdk)
RHEL_TAG = RHEL_TAG
RHEL_RELEASE_LINE = RHEL_RELEASE_LINE
JAVA_VERSION = javaversion(jdk)
}
tags = linux_tags(current_rhel, jdk)
platforms = platforms(current_rhel, jdk)
}

target "windowsservercore" {
matrix = {
jdk = jdks_to_build()
windows_version = windowsversions()
}
name = "${windows_version}_jdk${jdk}"
dockerfile = "windows/windowsservercore/hotspot/Dockerfile"
context = "."
args = {
JENKINS_VERSION = JENKINS_VERSION
WAR_SHA = WAR_SHA
WAR_URL = war_url()
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
JAVA_VERSION = javaversion(jdk)
JAVA_HOME = "C:/openjdk-${jdk}"
WINDOWS_VERSION = windows_version
}
tags = windows_tags(windows_version, jdk)
platforms = ["windows/amd64"]
}

## Groups
group "linux" {
targets = [
Expand All @@ -174,6 +209,19 @@ group "linux" {
]
}

group "windows" {
targets = [
"windowsservercore"
]
}

group "all" {
targets = [
"linux",
"windows",
]
}

## Common functions
# return true if JENKINS_VERSION is a Weekly (one sequence of digits with a trailing literal '.')
function "is_jenkins_version_weekly" {
Expand Down Expand Up @@ -290,6 +338,25 @@ function "linux_tags" {
)
}

# Return an array of tags depending on the agent type, the jdk
# and the flavor and version of Windows passed as parameters (ex: windowsservercore-ltsc2022)
function "windows_tags" {
params = [distribution, jdk]
result = [
## Always publish explicit jdk tag
tag(true, "jdk${jdk}-hotspot-${distribution}"),
tag_weekly(false, "jdk${jdk}-hotspot-${distribution}"),
tag_lts(false, "lts-jdk${jdk}-hotspot-${distribution}"),

# ## Default JDK extra short tags
is_default_jdk(jdk) ? tag(true, "hotspot-${distribution}") : "",
is_default_jdk(jdk) ? tag_weekly(false, distribution) : "",
is_default_jdk(jdk) ? tag_weekly(true, distribution) : "",
is_default_jdk(jdk) ? tag_lts(false, "lts-${distribution}") : "",
is_default_jdk(jdk) ? tag_lts(true, distribution) : "",
]
}

# Return if the distribution passed in parameter is Alpine
function "is_alpine" {
params = [distribution]
Expand Down Expand Up @@ -351,3 +418,13 @@ function "debian_tags" {
is_default_jdk(jdk) ? tag_lts(true, slim_suffix(variant, "lts")) : "",
]
}

# Return array of Windows version(s) to build
# Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version
# Ex: WINDOWS_VERSION_OVERRIDE=ltsc2025 docker buildx bake windows
function "windowsversions" {
params = []
result = (notequal(WINDOWS_VERSION_OVERRIDE, "")
? [WINDOWS_VERSION_OVERRIDE]
: is_jenkins_version_weekly() ? windows_version_to_build_for_weekly : windows_version_to_build_for_lts)
}
Loading