jenkinsfile_update2head: added info about triggered user to commit msg
BugzID: 73574 Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
parent
d34fa204e1
commit
32ab6f42ca
|
|
@ -16,7 +16,7 @@ pipeline {
|
|||
}
|
||||
|
||||
options {
|
||||
timeout(time: 8, unit: 'HOURS')
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
buildDiscarder(
|
||||
logRotator(numToKeepStr: '5',
|
||||
daysToKeepStr: '5',
|
||||
|
|
@ -72,21 +72,12 @@ def printJobParameters() {
|
|||
def prepareUpdate() {
|
||||
sh 'git submodule init' // init submodules used if first checkout
|
||||
|
||||
def userId = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId()
|
||||
println "userId = ${userId}"
|
||||
def userId = "${currentBuild.getBuildCauses()[0].userId}"
|
||||
def userName = "${currentBuild.getBuildCauses()[0].userName}"
|
||||
env.TRIGGERED_USER = "${userName} (userId=${userId})"
|
||||
|
||||
def userIdCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')[0]
|
||||
println userIdCause
|
||||
|
||||
def buildCause = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
|
||||
println "userName: ${buildCause.userName}"
|
||||
|
||||
def triggerDescription = "${currentBuild.getBuildCauses()[0].shortDescription}"
|
||||
def triggerUserId = "${currentBuild.getBuildCauses()[0].userId}"
|
||||
println "description: ${triggerDescription} ; userId: ${triggerUserId}"
|
||||
|
||||
def notNmUpdate = "${!params.BUILD_FROM_DEV_IMAGE}"
|
||||
def notCommunityUpdate = "${!params.BUILD_FROM_DEV_IMAGE}"
|
||||
def notNmUpdate = "${!params.UPDATE_NM_PARTS}"
|
||||
def notCommunityUpdate = "${!params.UPDATE_COMMUNITY_PARTS}"
|
||||
if(notNmUpdate.toBoolean() && notCommunityUpdate.toBoolean()) {
|
||||
error("Nothing to update selected - both parameters are false")
|
||||
}
|
||||
|
|
@ -106,9 +97,9 @@ def updateSubmodules(isNmUpdate, isCommunityUpdate) {
|
|||
|
||||
def commitChanges(isNmUpdate, isCommunityUpdate) {
|
||||
String updatedLayers = ""
|
||||
if(isNmUpdate) { updatedLayers += "netmoudle"}
|
||||
if(isNmUpdate) { updatedLayers += "netmodule"}
|
||||
if(isNmUpdate && isCommunityUpdate) { updatedLayers += " and " }
|
||||
if(isCommunityUpdate) { updatedLayers += "community" }
|
||||
sh(script: "git add -u")
|
||||
sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes\" && git push")
|
||||
sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes, triggered by ${env.TRIGGERED_USER}\" && git push")
|
||||
}
|
||||
Loading…
Reference in New Issue