From 32ab6f42ca478fd61d9aafa62f8edba3f8d5bf10 Mon Sep 17 00:00:00 2001 From: Marc Mattmueller Date: Tue, 6 Jul 2021 11:57:50 +0200 Subject: [PATCH] jenkinsfile_update2head: added info about triggered user to commit msg BugzID: 73574 Signed-off-by: Marc Mattmueller --- Jenkinsfile_update2head | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile_update2head b/Jenkinsfile_update2head index ea162eb..d3b5ba1 100644 --- a/Jenkinsfile_update2head +++ b/Jenkinsfile_update2head @@ -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") } \ No newline at end of file