From 652739e0f0b194777ce8b0615e515a7c1eb34626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Mattm=C3=BCller?= Date: Mon, 11 Sep 2023 15:49:16 +0200 Subject: [PATCH] jobs: added job parameter to force the source revision update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the latest version where the nightly branch is forwarded to the build job, the source revision update is no longer necessary. But in case of a manual trigger of the build job it makes sense to keep the functionality. Thus, an additional parameter is introduced to the build target job. With it the nightly job and the common files are updated too. Signed-off-by: Marc Mattmüller --- jobs/Jenkinsfile_BuildAll | 1 + jobs/Jenkinsfile_BuildTarget | 16 +++++++++------- jobs/Jenkinsfile_Common | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/jobs/Jenkinsfile_BuildAll b/jobs/Jenkinsfile_BuildAll index 2c84893..9571611 100644 --- a/jobs/Jenkinsfile_BuildAll +++ b/jobs/Jenkinsfile_BuildAll @@ -192,6 +192,7 @@ def runBuildJob(commonHelpers, buildTarget, buildBranch) { booleanParam(name: 'CLEAN_BUILD', value: params.CLEAN_BUILD), booleanParam(name: 'DEPLOY_TO_NEXUS', value: params.DEPLOY_TO_NEXUS), booleanParam(name: 'SKIP_SSTATE_UPLOAD', value: params.SKIP_SSTATE_UPLOAD), + booleanParam(name: 'FORCE_SRC_REV_UPDATE', value: false), booleanParam(name: 'DEBUGGING', value: params.DEBUGGING)] ) } diff --git a/jobs/Jenkinsfile_BuildTarget b/jobs/Jenkinsfile_BuildTarget index 21a34d2..706f6c1 100644 --- a/jobs/Jenkinsfile_BuildTarget +++ b/jobs/Jenkinsfile_BuildTarget @@ -40,6 +40,7 @@ pipeline { booleanParam(name: 'CLEAN_BUILD', defaultValue: false, description: 'do a clean build, i.e. remove the yocto directory and start from scratch') booleanParam(name: 'DEPLOY_TO_NEXUS', defaultValue: true, description: 'deploy the built artifact to Nexus') booleanParam(name: 'SKIP_SSTATE_UPLOAD', defaultValue: false, description: 'skip uploading/synchronizing the sstate-cache to the mirror') + booleanParam(name: 'FORCE_SRC_REV_UPDATE', defaultValue: false, description: 'force a source revision update, e.g. when you are triggering this job manually') booleanParam(name: 'DEBUGGING', defaultValue: false, description: 'debugging mode, removes quiet mode for bitbake') } @@ -121,12 +122,13 @@ def printJobParameters() { println "----------------------------------\n\ Job Parameters:\n\ ----------------------------------\n\ - TARGET = ${params.TARGET}\n\ - BUILD_BRANCH = ${params.BUILD_BRANCH}\n\ - CLEAN_BUILD = ${params.CLEAN_BUILD}\n\ - DEPLOY_TO_NEXUS = ${params.DEPLOY_TO_NEXUS}\n\ - SKIP_SSTATE_UPLOAD = ${params.SKIP_SSTATE_UPLOAD}\n\ - DEBUGGING = ${params.DEBUGGING}\n\ + TARGET = ${params.TARGET}\n\ + BUILD_BRANCH = ${params.BUILD_BRANCH}\n\ + CLEAN_BUILD = ${params.CLEAN_BUILD}\n\ + DEPLOY_TO_NEXUS = ${params.DEPLOY_TO_NEXUS}\n\ + SKIP_SSTATE_UPLOAD = ${params.SKIP_SSTATE_UPLOAD}\n\ + FORCE_SRC_REV_UPDATE = ${params.FORCE_SRC_REV_UPDATE}\n\ + DEBUGGING = ${params.DEBUGGING}\n\ ----------------------------------\n" } @@ -151,7 +153,7 @@ def setupEnvironment(commonHelpers) { def machine = "${env.TARGET}" def nwlBranch = "${params.BUILD_BRANCH}" def nwlRepoDir = "${env.YOCTO_REPO_DIR}" - commonHelpers.setupBuildEnvironment(machine, nwlBranch, nwlRepoDir, params.DEBUGGING) + commonHelpers.setupBuildEnvironment(machine, nwlBranch, nwlRepoDir, params.DEBUGGING, params.FORCE_SRC_REV_UPDATE) commonHelpers.printEnvironmentParameters() } diff --git a/jobs/Jenkinsfile_Common b/jobs/Jenkinsfile_Common index ed6eaac..caf0fbf 100644 --- a/jobs/Jenkinsfile_Common +++ b/jobs/Jenkinsfile_Common @@ -231,7 +231,7 @@ def setupEnvironmentForArtifacts(machine) { env.YOCTO_ARTIFACTS = "${env.YOCTO_DEPLOYS}/${env.BITBAKE_PKG}-${machine}.ci-artifacts" } //----------------------------------------------------------------------------- -def setupBuildEnvironment(machine, branchTag, cloneDir, isDebug) { +def setupBuildEnvironment(machine, branchTag, cloneDir, isDebug, isSrcRevUpdateForced) { // with the machine parameter it will be possible to set up different // environment variables in here. Currently we use the SolidRun board @@ -248,7 +248,7 @@ def setupBuildEnvironment(machine, branchTag, cloneDir, isDebug) { env.BITBAKE_CMD = "${env.ISQUIET} ${env.BITBAKE_PKG}" removePreExistingYoctoConfigs(confPath) - gitCheckout("${env.YOCTO_REPO_URL}", branchTag, cloneDir, true) + gitCheckout("${env.YOCTO_REPO_URL}", branchTag, cloneDir, true, isSrcRevUpdateForced) env.PKG_NAME = "${env.BITBAKE_PKG}-${machine}" sh("mkdir -p ${env.DEPLOY_CONTENT_DIR}")