jobs/updateSrcRev: added cloning of the repository (was missing)

Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmüller 2023-09-04 12:50:08 +02:00
parent 3ff3dc9435
commit c4d49cdc0e
1 changed files with 33 additions and 28 deletions

View File

@ -32,6 +32,7 @@ pipeline {
common = load "./jobs/Jenkinsfile_Common" common = load "./jobs/Jenkinsfile_Common"
handleCleanBuild(common) handleCleanBuild(common)
common.gitCheckout("${env.YOCTO_REPO_URL}", "${params.BUILD_BRANCH}", "${env.YOCTO_REPO_DIR}", true)
} }
} }
} }
@ -39,14 +40,14 @@ pipeline {
stage('Update') { stage('Update') {
steps { steps {
script { script {
updateTheSourceRevisions(common, "${params.BUILD_BRANCH}") updateTheSourceRevisions(common, "${env.YOCTO_REPO_DIR}", "${params.BUILD_BRANCH}")
commitAndPushTheChanges(common) commitAndPushTheChanges(common, "${env.YOCTO_REPO_DIR}")
} }
} }
post { post {
always { always {
script { script {
common.cleanupRepository("./") common.cleanupRepository("${env.YOCTO_REPO_DIR}")
} }
} }
} }
@ -83,14 +84,17 @@ def handleCleanBuild(commonHelpers) {
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
def updateTheSourceRevisions(commonHelpers, theBranch) { def updateTheSourceRevisions(commonHelpers, repoDir, theBranch) {
dir(repoDir) {
commonHelpers.gitUpdateSubmodulesCheckoutBranch(theBranch, true, true) commonHelpers.gitUpdateSubmodulesCheckoutBranch(theBranch, true, true)
commonHelpers.printSubmoduleStatus(true) commonHelpers.printSubmoduleStatus(true)
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
def commitAndPushTheChanges(commonHelpers) { def commitAndPushTheChanges(commonHelpers, repoDir) {
def commitMsg = "srcrev: updated source revisions by Jenkins Job" def commitMsg = "srcrev: updated source revisions by Jenkins Job"
dir(repoDir) {
if(sh(returnStdout: true, script: "git status | grep \"modified:\" | grep -v coreos | wc -l").toInteger() != 0) { if(sh(returnStdout: true, script: "git status | grep \"modified:\" | grep -v coreos | wc -l").toInteger() != 0) {
def itemFindCmd = "git status | grep \"modified:\" | grep -v coreos | cut -d':' -f2 | sed -e 's/^[ ]*//' | cut -d' ' -f1" def itemFindCmd = "git status | grep \"modified:\" | grep -v coreos | cut -d':' -f2 | sed -e 's/^[ ]*//' | cut -d' ' -f1"
def changedItems = sh(returnStdout: true, script: "${itemFindCmd}") def changedItems = sh(returnStdout: true, script: "${itemFindCmd}")
@ -116,3 +120,4 @@ def commitAndPushTheChanges(commonHelpers) {
} }
} }
} }
}