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

breaking: set Java 17 as default #520

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ after setting **Remote root directory** to `/home/jenkins/agent`.
or if using Windows Containers

```powershell
docker run -i --rm --name agent --init jenkins/agent:jdk11-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar
docker run -i --rm --name agent --init jenkins/agent:jdk17-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar
```

after setting **Remote root directory** to `C:\Users\jenkins\Agent`.
Expand All @@ -62,22 +62,28 @@ docker run -i --rm --name agent1 --init -v agent1-workdir:C:/Users/jenkins/Work
The image has several supported configurations, which can be accessed via the following tags:

* Linux Images:
* `latest` (`jdk11`, `bookworm-jdk11`, `latest-bookworm-jdk11`, `latest-jdk11`): Latest version with the newest remoting and Java 11 (based on `debian:bookworm-${builddate}`)
* `alpine` (`alpine-jdk11`, `latest-alpine`, `latest-alpine-jdk11`): Small image based on Alpine Linux (based on `alpine:${version}`)
* `archlinux` (`latest-archlinux`, `archlinux-jdk11`, `latest-archlinux-jdk11`): Image based on Arch Linux with JDK11 (based on `archlinux:latest`)
* `bookworm-jdk17` (`jdk17`, `latest-bookworm-jdk17`, `latest-jdk17`): JDK17 version with the newest remoting (based on `debian:bookworm-${builddate}`)
* `latest` (`jdk17`, `bookworm-jdk17`, `latest-bookworm`, `latest-bookworm-jdk17`, `latest-jdk17`): Latest version with the newest remoting and JDK17 (based on `debian:bookworm-${builddate}`)
* `alpine` (`alpine-jdk17`, `latest-alpine`, `latest-alpine-jdk17`): Small image based on Alpine Linux with JDK17 (based on `alpine:${version}`)
* `archlinux` (`archlinux-jdk17`, `latest-archlinux`, `latest-archlinux-jdk17`): Image based on Arch Linux with JDK17 (based on `archlinux:latest`)
* `bookworm-jdk11` (`latest-bookworm-jdk11`, `latest-jdk11`): JDK11 version with the newest remoting (based on `debian:bookworm-${builddate}`)
* `alpine-jdk11` (`latest-alpine-jdk11`): Small image based on Alpine Linux with JDK11 (based on `alpine:${version}`)
* `archlinux-jdk11` (`latest-archlinux-jdk11`): Image based on Arch Linux with JDK11 (based on `archlinux:latest`)
lemeurherve marked this conversation as resolved.
Show resolved Hide resolved

From version 4.11.2, the alpine images are tagged using the alpine OS version as well (i.e. `alpine` ==> `alpine3.16`, `alpine-jdk11` ==> `alpine3.16-jdk11`).

* Windows Images:
* `jdk11-nanoserver-1809`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `eclipse-temurin:11.xxx-jdk-nanoserver-1809`)
* `jdk11-windowsservercore-ltsc2019`: Latest version with the newest remoting and Java 11 (based on `eclipse-temurin:11.xxx-jdk-windowsservercore-ltsc2019`)
* `jdk17-nanoserver-1809`: Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `eclipse-temurin:17.xxx-jdk-nanoserver-1809`)
* `jdk17-windowsservercore-ltsc2019`: Latest version with the newest remoting and Java 17 (based on `eclipse-temurin:17.xxx-jdk-windowsservercore-ltsc2019`)
* `jdk11-nanoserver-ltsc2022`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `eclipse-temurin:11.xxx-jdk-nanoserver-ltsc2022`)
* `jdk11-windowsservercore-ltsc2022`: Latest version with the newest remoting and Java 11 (based on `eclipse-temurin:11.xxx-jdk-windowsservercore-ltsc2022`)
* `jdk17-nanoserver-ltsc2022`: Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `eclipse-temurin:17.xxx-jdk-nanoserver-ltsc2022`)
* `jdk17-windowsservercore-ltsc2022`: Latest version with the newest remoting and Java 17 (based on `eclipse-temurin:17.xxx-jdk-windowsservercore-ltsc2022`)
* `jdk11-nanoserver-1809`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:1809` and `eclipse-temurin:11.xxx-jdk-nanoserver-1809`)
* `jdk11-nanoserver-ltsc2019`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2019` and `eclipse-temurin:11.xxx-jdk-nanoserver-1809`)
* `jdk11-nanoserver-ltsc2022`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2022` and `eclipse-temurin:11.xxx-jdk-nanoserver-ltsc2022`)
* `jdk11-windowsservercore-1809`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:1809` and `eclipse-temurin:11.xxx-jdk-windowsservercore-1809`)
* `jdk11-windowsservercore-ltsc2019`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:ltsc2019` and `eclipse-temurin:11.xxx-jdk-windowsservercore-1809`)
* `jdk11-windowsservercore-ltsc2022`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:ltsc2022` and `eclipse-temurin:11.xxx-jdk-windowsservercore-ltsc2022`)
* `jdk17-nanoserver-1809` (`nanoserver-1809`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:1809` and `eclipse-temurin:17.xxx-jdk-nanoserver-1809`)
* `jdk17-nanoserver-ltsc2019` (`nanoserver-ltsc2019`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2019` and `eclipse-temurin:17.xxx-jdk-nanoserver-1809`)
* `jdk17-nanoserver-ltsc2022` (`nanoserver-ltsc2022`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2022` and `eclipse-temurin:17.xxx-jdk-nanoserver-ltsc2022`)
* `jdk17-windowsservercore-1809` (`windowsservercore-1809`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:1809` and `eclipse-temurin:17.xxx-jdk-windowsservercore-1809`)
* `jdk17-windowsservercore-ltsc2019` (`windowsservercore-ltsc2019`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:ltsc2019` and `eclipse-temurin:17.xxx-jdk-windowsservercore-1809`)
* `jdk17-windowsservercore-ltsc2022` (`windowsservercore-ltsc2022`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:ltsc2022` and `eclipse-temurin:17.xxx-jdk-windowsservercore-ltsc2022`)

The file `docker-bake.hcl` defines all the configuration for Linux images and their associated tags.

Expand Down
6 changes: 3 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Function Test-CommandExists {
}
}

# this is the jdk version that will be used for the 'bare tag' images, e.g., jdk8-windowsservercore-1809 -> windowsserver-1809
$defaultJdk = '11'
# this is the jdk version that will be used for the 'bare tag' images, e.g., jdk17-windowsservercore-1809 -> windowsserver-1809
$defaultJdk = '17'
$builds = @{}
$env:REMOTING_VERSION = "$RemotingVersion"

Expand All @@ -87,7 +87,7 @@ $baseDockerCmd = 'docker-compose --file=build-windows.yaml'
$baseDockerBuildCmd = '{0} build --parallel --pull' -f $baseDockerCmd

Invoke-Expression "$baseDockerCmd config --services" 2>$null | ForEach-Object {
$image = '{0}-{1}-{2}' -f $_, $env:WINDOWS_FLAVOR, $env:WINDOWS_VERSION_TAG # Ex: "jdk11-nanoserver-1809"
$image = '{0}-{1}-{2}' -f $_, $env:WINDOWS_FLAVOR, $env:WINDOWS_VERSION_TAG # Ex: "jdk17-nanoserver-1809"

# Remove the 'jdk' prefix
$jdkMajorVersion = $_.Remove(0,3)
Expand Down
39 changes: 28 additions & 11 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ group "linux" {
"alpine_jdk17",
"alpine_jdk21",
"archlinux_jdk11",
"archlinux_jdk17",
lemeurherve marked this conversation as resolved.
Show resolved Hide resolved
"debian_jdk11",
"debian_jdk17",
"debian_jdk21",
Expand Down Expand Up @@ -100,16 +101,31 @@ target "archlinux_jdk11" {
VERSION = REMOTING_VERSION
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-archlinux" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-archlinux-jdk11" : "",
lemeurherve marked this conversation as resolved.
Show resolved Hide resolved
"${REGISTRY}/${JENKINS_REPO}:archlinux",
"${REGISTRY}/${JENKINS_REPO}:latest-archlinux",
"${REGISTRY}/${JENKINS_REPO}:archlinux-jdk11",
"${REGISTRY}/${JENKINS_REPO}:latest-archlinux-jdk11",
]
platforms = ["linux/amd64"]
}

target "archlinux_jdk17" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not add this, it doesn't make sense for me that we need an arch image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 7fc8b83, can be reverted or added in another PR if needed.

dockerfile = "archlinux/Dockerfile"
context = "."
args = {
JAVA_VERSION = JAVA17_VERSION
VERSION = REMOTING_VERSION
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-archlinux" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-archlinux-jdk17" : "",
"${REGISTRY}/${JENKINS_REPO}:archlinux",
"${REGISTRY}/${JENKINS_REPO}:latest-archlinux",
"${REGISTRY}/${JENKINS_REPO}:archlinux-jdk17",
"${REGISTRY}/${JENKINS_REPO}:latest-archlinux-jdk17",
]
platforms = ["linux/amd64"]
}

lemeurherve marked this conversation as resolved.
Show resolved Hide resolved
target "alpine_jdk11" {
dockerfile = "alpine/Dockerfile"
context = "."
Expand All @@ -119,16 +135,10 @@ target "alpine_jdk11" {
VERSION = REMOTING_VERSION
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine${ALPINE_SHORT_TAG}" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine-jdk11" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine${ALPINE_SHORT_TAG}-jdk11" : "",
"${REGISTRY}/${JENKINS_REPO}:alpine",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}",
"${REGISTRY}/${JENKINS_REPO}:alpine-jdk11",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk11",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk11",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk11",
]
Expand All @@ -144,10 +154,16 @@ target "alpine_jdk17" {
VERSION = REMOTING_VERSION
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine${ALPINE_SHORT_TAG}" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine-jdk17" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-alpine${ALPINE_SHORT_TAG}-jdk17" : "",
"${REGISTRY}/${JENKINS_REPO}:alpine",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}",
"${REGISTRY}/${JENKINS_REPO}:alpine-jdk17",
"${REGISTRY}/${JENKINS_REPO}:alpine${ALPINE_SHORT_TAG}-jdk17",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine-jdk17",
"${REGISTRY}/${JENKINS_REPO}:latest-alpine${ALPINE_SHORT_TAG}-jdk17",
]
Expand Down Expand Up @@ -182,11 +198,9 @@ target "debian_jdk11" {
DEBIAN_RELEASE = DEBIAN_RELEASE
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk11" : "",
"${REGISTRY}/${JENKINS_REPO}:bookworm-jdk11",
"${REGISTRY}/${JENKINS_REPO}:jdk11",
"${REGISTRY}/${JENKINS_REPO}:latest",
"${REGISTRY}/${JENKINS_REPO}:latest-bookworm-jdk11",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk11",
]
Expand All @@ -202,9 +216,12 @@ target "debian_jdk17" {
DEBIAN_RELEASE = DEBIAN_RELEASE
}
tags = [
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}" : "",
equal(ON_TAG, "true") ? "${REGISTRY}/${JENKINS_REPO}:${REMOTING_VERSION}-${BUILD_NUMBER}-jdk17" : "",
"${REGISTRY}/${JENKINS_REPO}:bookworm-jdk17",
"${REGISTRY}/${JENKINS_REPO}:jdk17",
"${REGISTRY}/${JENKINS_REPO}:latest",
"${REGISTRY}/${JENKINS_REPO}:latest-bookworm",
"${REGISTRY}/${JENKINS_REPO}:latest-bookworm-jdk17",
"${REGISTRY}/${JENKINS_REPO}:latest-jdk17",
]
Expand Down