jenkinsfile_update2head: added info about updated layers to commit msg

BugzID: 73574
Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-07-06 11:38:28 +02:00 committed by Gitea
parent e9ee8240e3
commit d34fa204e1
1 changed files with 8 additions and 7 deletions

View File

@ -47,7 +47,7 @@ pipeline {
stage('commit') { stage('commit') {
steps { steps {
commitChanges() commitChanges(params.UPDATE_NM_PARTS, params.UPDATE_COMMUNITY_PARTS)
} }
post { post {
success { success {
@ -93,21 +93,22 @@ def prepareUpdate() {
} }
def updateSubmodules(isNmUpdate, isCommunityUpdate) { def updateSubmodules(isNmUpdate, isCommunityUpdate) {
def updatedPart = ""
if(isNmUpdate) { if(isNmUpdate) {
sh(script: "git submodule update --remote --rebase meta-netmodule-*" sh(script: "git submodule update --remote --rebase meta-netmodule-*")
updatedPart = "netmodule"
} }
if(isCommunityUpdate) { if(isCommunityUpdate) {
sh(script: "git submodule update --remote --rebase \$(git submodule status | grep -v \"meta-netmodule-*\" | sed 's/^ *//g' | cut -d' ' -f2)") sh(script: "git submodule update --remote --rebase \$(git submodule status | grep -v \"meta-netmodule-*\" | sed 's/^ *//g' | cut -d' ' -f2)")
updatedPart = "community"
} }
submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
println "${submoduleStatus}" println "${submoduleStatus}"
writeFile(file: "${env.SUBMODULE_VERION_FILE}", text: "${submoduleStatus}") writeFile(file: "${env.SUBMODULE_VERION_FILE}", text: "${submoduleStatus}")
} }
def commitChanges() { def commitChanges(isNmUpdate, isCommunityUpdate) {
String updatedLayers = ""
if(isNmUpdate) { updatedLayers += "netmoudle"}
if(isNmUpdate && isCommunityUpdate) { updatedLayers += " and " }
if(isCommunityUpdate) { updatedLayers += "community" }
sh(script: "git add -u") sh(script: "git add -u")
sh(script: "git commit -m \"submodules: updated ${updatedPart} hashes\" && git push") sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes\" && git push")
} }