-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Download war from mirrors unless we are publishing a release #2059
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
base: master
Are you sure you want to change the base?
Changes from all commits
a4f7d50
2f3ad8b
681df4c
8d43ef0
c1a9aef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -90,13 +90,13 @@ RUN mkdir -p ${REF}/init.groovy.d | |||||
|
||||||
# jenkins version being bundled in this docker image | ||||||
ARG JENKINS_VERSION | ||||||
ENV JENKINS_VERSION=${JENKINS_VERSION:-2.504} | ||||||
ENV JENKINS_VERSION=${JENKINS_VERSION:-2.516.1} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
In order to avoid spreading the same value on multiple locations, which makes it tedious to maintain, WDYT about avoiding passing any default version? We keep the |
||||||
|
||||||
# jenkins.war checksum, download will be validated using it | ||||||
ARG JENKINS_SHA=efc91d6be8d79dd078e7f930fc4a5f135602d0822a5efe9091808fdd74607d32 | ||||||
ARG JENKINS_SHA=c308a27e81f4ce3aa6787e96caf771534f7f206fefbb83969d77b15fc7f2700a | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
WDYT we apply the same pattern as other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That changes the development experience by requiring that every invocation of |
||||||
|
||||||
# Can be used to customize where jenkins.war get downloaded from | ||||||
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war | ||||||
ARG JENKINS_URL | ||||||
|
||||||
# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum | ||||||
# see https://github.com/docker/docker/issues/8331 | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -43,11 +43,11 @@ group "linux-ppc64le" { | |||||||||
# ---- variables ---- | ||||||||||
|
||||||||||
variable "JENKINS_VERSION" { | ||||||||||
default = "2.504" | ||||||||||
default = "2.516.1" | ||||||||||
} | ||||||||||
|
||||||||||
variable "JENKINS_SHA" { | ||||||||||
default = "efc91d6be8d79dd078e7f930fc4a5f135602d0822a5efe9091808fdd74607d32" | ||||||||||
default = "c308a27e81f4ce3aa6787e96caf771534f7f206fefbb83969d77b15fc7f2700a" | ||||||||||
} | ||||||||||
|
||||||||||
variable "REGISTRY" { | ||||||||||
|
@@ -94,6 +94,12 @@ variable "BOOKWORM_TAG" { | |||||||||
default = "20250721" | ||||||||||
} | ||||||||||
|
||||||||||
variable "JENKINS_URL" { } | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
WDYT if we define the "most common" value here (e.g. the current default which will be kept) and we only define a custom URL on the ci.jenkins.io pipeline? The goal would be to avoid the tedious logic around our "war" / "war-stable" detection. Your code works marvelously but it is still some branching code to maintain inside a declarative (docker bake) system There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried that as one of my first iterations and was unable to persuade the bake file to expand the value of JENKINS_VERSION at the correct time. I abandoned the idea because no other variable in the file uses other variables to expand them. If there is a way to do that, I'm open to it. I couldn't make it work with my efforts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to take a shot at it. Is this PR urgent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not at all. I'd love to have you look at it when you're back from vacation. |
||||||||||
|
||||||||||
variable "PUBLISH" { | ||||||||||
default = "false" | ||||||||||
} | ||||||||||
|
||||||||||
# ---- user-defined functions ---- | ||||||||||
|
||||||||||
# return a tag prefixed by the Jenkins version | ||||||||||
|
@@ -120,6 +126,22 @@ function "tag_lts" { | |||||||||
result = equal(LATEST_LTS, "true") ? tag(prepend_jenkins_version, tag) : "" | ||||||||||
} | ||||||||||
|
||||||||||
# return release line based on Jenkins version | ||||||||||
function "release_line" { | ||||||||||
# If there is more than one sequence of digits with a trailing literal '.', this is LTS | ||||||||||
# 2.523 has only one sequence of digits with a trailing literal '.' | ||||||||||
# 2.516.1 has two sequences of digits with a trailing literal '.' | ||||||||||
# https://developer.hashicorp.com/terraform/language/functions/regexall describes the technique | ||||||||||
params = [] | ||||||||||
result = length(regexall("[0-9]+[.]", JENKINS_VERSION)) < 2 ? "war" : "war-stable" | ||||||||||
} | ||||||||||
|
||||||||||
# return Jenkins URL based on Jenkins version and release line | ||||||||||
function "jenkins_url" { | ||||||||||
params = [] | ||||||||||
result = equal("true",PUBLISH) ? "https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war" : "https://get.jenkins.io/${release_line()}/${JENKINS_VERSION}/jenkins.war" | ||||||||||
} | ||||||||||
|
||||||||||
# ---- targets ---- | ||||||||||
|
||||||||||
target "alpine_jdk17" { | ||||||||||
|
@@ -132,6 +154,7 @@ target "alpine_jdk17" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
ALPINE_TAG = ALPINE_FULL_TAG | ||||||||||
JAVA_VERSION = JAVA17_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "alpine-jdk17"), | ||||||||||
|
@@ -152,6 +175,7 @@ target "alpine_jdk21" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
ALPINE_TAG = ALPINE_FULL_TAG | ||||||||||
JAVA_VERSION = JAVA21_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "alpine"), | ||||||||||
|
@@ -176,6 +200,7 @@ target "debian_jdk17" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
BOOKWORM_TAG = BOOKWORM_TAG | ||||||||||
JAVA_VERSION = JAVA17_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "jdk17"), | ||||||||||
|
@@ -197,6 +222,7 @@ target "debian_jdk21" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
BOOKWORM_TAG = BOOKWORM_TAG | ||||||||||
JAVA_VERSION = JAVA21_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, ""), | ||||||||||
|
@@ -222,6 +248,7 @@ target "debian_slim_jdk17" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
BOOKWORM_TAG = BOOKWORM_TAG | ||||||||||
JAVA_VERSION = JAVA17_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "slim-jdk17"), | ||||||||||
|
@@ -241,6 +268,7 @@ target "debian_slim_jdk21" { | |||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
BOOKWORM_TAG = BOOKWORM_TAG | ||||||||||
JAVA_VERSION = JAVA21_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "slim"), | ||||||||||
|
@@ -263,6 +291,7 @@ target "rhel_ubi9_jdk17" { | |||||||||
COMMIT_SHA = COMMIT_SHA | ||||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
JAVA_VERSION = JAVA17_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "rhel-ubi9-jdk17"), | ||||||||||
|
@@ -282,6 +311,7 @@ target "rhel_ubi9_jdk21" { | |||||||||
COMMIT_SHA = COMMIT_SHA | ||||||||||
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION | ||||||||||
JAVA_VERSION = JAVA21_VERSION | ||||||||||
JENKINS_URL = jenkins_url() | ||||||||||
} | ||||||||||
tags = [ | ||||||||||
tag(true, "rhel-ubi9-jdk21"), | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,7 +105,7 @@ function Run-Program($cmd, $params, $verbose=$false) { | |
} | ||
|
||
function Build-Docker($tag) { | ||
$exitCode, $stdout, $stderr = Run-Program 'docker-compose' '--file=build-windows.yaml build --parallel' | ||
$exitCode, $stdout, $stderr = Run-Program 'docker-compose' '--file=build-windows.yaml build --parallel --build-arg JENKINS_URL=' + $env:JENKINS_URL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of changing the compose call, WDYT if we rely on https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/#additional-information instead? |
||
if($exitCode -ne 0) { | ||
return $exitCode, $stdout, $stderr | ||
} | ||
|
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.
Ideally, we should not need this detection (see my comment about default value)