Skip to content

Commit 3f000cf

Browse files
committed
build: use choice param for SKIP_UNTESTED_ARTIFACTS
We cannot have this method run in parameter scope because the first build on friday would have `SKIP_UNTESTED_ARTIFACTS` set to True and the next ones set to False. Jenkins only updates the default value after the first instanciation of the job. We move to choice parameter and introduces the dynamic value which is the default one. The allowed choices are now explicitly: - dynamic: rely on the should_we_skip_untested_artifacts() method. - yes: explicitly set the flag to true. - no: explicitly set the flag to false.
1 parent b5669dd commit 3f000cf

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

jobs/build-arch.Jenkinsfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ properties([
4848
booleanParam(name: 'NO_UPLOAD',
4949
defaultValue: false,
5050
description: 'Do not upload results to S3; for debugging purposes.'),
51-
booleanParam(name: 'SKIP_UNTESTED_ARTIFACTS',
52-
defaultValue: pipeutils.should_we_skip_untested_artifacts(pipecfg),
53-
description: 'Skip building and pushing any artifacts we do not CI test'),
51+
choice(name: 'SKIP_UNTESTED_ARTIFACTS',
52+
choices: ['dynamic', 'yes', 'no'],
53+
description: 'Skip building and pushing any artifacts we do not CI test'),
5454
string(name: 'SRC_CONFIG_COMMIT',
5555
description: 'The exact config repo git commit to build against',
5656
defaultValue: '',
@@ -81,7 +81,16 @@ cosa_img = cosa_img ?: pipeutils.get_cosa_img(pipecfg, params.STREAM)
8181

8282
def stream_info = pipecfg.streams[params.STREAM]
8383

84-
if (params.SKIP_UNTESTED_ARTIFACTS && stream_info.type == "production" ) {
84+
def skip_untested_artifacts = ""
85+
if (params.SKIP_UNTESTED_ARTIFACTS == "dynamic" ) {
86+
skip_untested_artifacts = pipeutils.should_we_skip_untested_artifacts(pipecfg)
87+
} else if (params.SKIP_UNTESTED_ARTIFACTS == "yes" ) {
88+
skip_untested_artifacts = true
89+
} else {
90+
skip_untested_artifacts = false
91+
}
92+
93+
if (skip_untested_artifacts && stream_info.type == "production" ) {
8594
error("Cannot specify SKIP_UNTESTED_ARTIFACTS parameter for production streams")
8695
}
8796

@@ -335,7 +344,7 @@ lock(resource: "build-${params.STREAM}-${basearch}") {
335344

336345
// Build the remaining artifacts
337346
stage("Build Artifacts") {
338-
pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, params.SKIP_UNTESTED_ARTIFACTS)
347+
pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, skip_untested_artifacts)
339348
}
340349

341350
// secex specific tests.

jobs/build.Jenkinsfile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ properties([
5353
booleanParam(name: 'NO_UPLOAD',
5454
defaultValue: false,
5555
description: 'Do not upload results to S3; for debugging purposes.'),
56-
booleanParam(name: 'SKIP_UNTESTED_ARTIFACTS',
57-
defaultValue: pipeutils.should_we_skip_untested_artifacts(pipecfg),
58-
description: 'Skip building and pushing any artifacts we do not CI test'),
56+
choice(name: 'SKIP_UNTESTED_ARTIFACTS',
57+
choices: ['dynamic', 'yes', 'no'],
58+
description: 'Skip building and pushing any artifacts we do not CI test'),
5959
booleanParam(name: 'WAIT_FOR_RELEASE_JOB',
6060
defaultValue: false,
6161
description: 'Wait for the release job and propagate errors.'),
@@ -94,7 +94,16 @@ def stream_info = pipecfg.streams[params.STREAM]
9494
// runtime parameter always wins
9595
def no_upload = params.NO_UPLOAD ?: stream_info.get('no_upload', false)
9696

97-
if (params.SKIP_UNTESTED_ARTIFACTS && stream_info.type == "production" ) {
97+
def skip_untested_artifacts = ""
98+
if (params.SKIP_UNTESTED_ARTIFACTS == "dynamic" ) {
99+
skip_untested_artifacts = pipeutils.should_we_skip_untested_artifacts(pipecfg)
100+
} else if (params.SKIP_UNTESTED_ARTIFACTS == "yes" ) {
101+
skip_untested_artifacts = true
102+
} else {
103+
skip_untested_artifacts = false
104+
}
105+
106+
if (skip_untested_artifacts && stream_info.type == "production" ) {
98107
error("Cannot specify SKIP_UNTESTED_ARTIFACTS parameter for production streams")
99108
}
100109

@@ -416,7 +425,7 @@ lock(resource: "build-${params.STREAM}") {
416425

417426
// Build the remaining artifacts
418427
stage("Build Artifacts") {
419-
pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, params.SKIP_UNTESTED_ARTIFACTS)
428+
pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, skip_untested_artifacts)
420429

421430
// Stop the build if the kernel + kernel-rt versions do not match.
422431
// This check runs on x86_64 RHCOS builds only.

0 commit comments

Comments
 (0)