From 477e68ba8c04e33b76915028330b71f4db4a04ec Mon Sep 17 00:00:00 2001 From: Joel Capitao Date: Fri, 21 Nov 2025 16:04:53 +0100 Subject: [PATCH] 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. --- jobs/build-arch.Jenkinsfile | 19 ++++++++++++++----- jobs/build.Jenkinsfile | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/jobs/build-arch.Jenkinsfile b/jobs/build-arch.Jenkinsfile index 4a0e51a54..89546e20e 100644 --- a/jobs/build-arch.Jenkinsfile +++ b/jobs/build-arch.Jenkinsfile @@ -48,9 +48,9 @@ properties([ booleanParam(name: 'NO_UPLOAD', defaultValue: false, description: 'Do not upload results to S3; for debugging purposes.'), - booleanParam(name: 'SKIP_UNTESTED_ARTIFACTS', - defaultValue: pipeutils.should_we_skip_untested_artifacts(pipecfg), - description: 'Skip building and pushing any artifacts we do not CI test'), + choice(name: 'SKIP_UNTESTED_ARTIFACTS', + choices: ['dynamic', 'yes', 'no'], + description: 'Skip building and pushing any artifacts we do not CI test'), string(name: 'SRC_CONFIG_COMMIT', description: 'The exact config repo git commit to build against', defaultValue: '', @@ -81,7 +81,16 @@ cosa_img = cosa_img ?: pipeutils.get_cosa_img(pipecfg, params.STREAM) def stream_info = pipecfg.streams[params.STREAM] -if (params.SKIP_UNTESTED_ARTIFACTS && stream_info.type == "production" ) { +def skip_untested_artifacts = "" +if (params.SKIP_UNTESTED_ARTIFACTS == "dynamic" ) { + skip_untested_artifacts = pipeutils.should_we_skip_untested_artifacts(pipecfg) +} else if (params.SKIP_UNTESTED_ARTIFACTS == "yes" ) { + skip_untested_artifacts = true +} else { + skip_untested_artifacts = false +} + +if (skip_untested_artifacts && stream_info.type == "production" ) { error("Cannot specify SKIP_UNTESTED_ARTIFACTS parameter for production streams") } @@ -335,7 +344,7 @@ lock(resource: "build-${params.STREAM}-${basearch}") { // Build the remaining artifacts stage("Build Artifacts") { - pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, params.SKIP_UNTESTED_ARTIFACTS) + pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, skip_untested_artifacts) } // secex specific tests. diff --git a/jobs/build.Jenkinsfile b/jobs/build.Jenkinsfile index fe54dec17..fe23927b0 100644 --- a/jobs/build.Jenkinsfile +++ b/jobs/build.Jenkinsfile @@ -53,9 +53,9 @@ properties([ booleanParam(name: 'NO_UPLOAD', defaultValue: false, description: 'Do not upload results to S3; for debugging purposes.'), - booleanParam(name: 'SKIP_UNTESTED_ARTIFACTS', - defaultValue: pipeutils.should_we_skip_untested_artifacts(pipecfg), - description: 'Skip building and pushing any artifacts we do not CI test'), + choice(name: 'SKIP_UNTESTED_ARTIFACTS', + choices: ['dynamic', 'yes', 'no'], + description: 'Skip building and pushing any artifacts we do not CI test'), booleanParam(name: 'WAIT_FOR_RELEASE_JOB', defaultValue: false, description: 'Wait for the release job and propagate errors.'), @@ -94,7 +94,16 @@ def stream_info = pipecfg.streams[params.STREAM] // runtime parameter always wins def no_upload = params.NO_UPLOAD ?: stream_info.get('no_upload', false) -if (params.SKIP_UNTESTED_ARTIFACTS && stream_info.type == "production" ) { +def skip_untested_artifacts = "" +if (params.SKIP_UNTESTED_ARTIFACTS == "dynamic" ) { + skip_untested_artifacts = pipeutils.should_we_skip_untested_artifacts(pipecfg) +} else if (params.SKIP_UNTESTED_ARTIFACTS == "yes" ) { + skip_untested_artifacts = true +} else { + skip_untested_artifacts = false +} + +if (skip_untested_artifacts && stream_info.type == "production" ) { error("Cannot specify SKIP_UNTESTED_ARTIFACTS parameter for production streams") } @@ -417,7 +426,7 @@ lock(resource: "build-${params.STREAM}") { // Build the remaining artifacts stage("Build Artifacts") { - pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, params.SKIP_UNTESTED_ARTIFACTS) + pipeutils.build_artifacts(pipecfg, params.STREAM, basearch, skip_untested_artifacts) // Stop the build if the kernel + kernel-rt versions do not match. // This check runs on x86_64 RHCOS builds only.