jenkins: provided ssh credentials from master for git commands
Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
parent
6a56c05981
commit
55ac1c7307
|
|
@ -40,6 +40,7 @@ def isRelease(versionParam) {
|
|||
|
||||
|
||||
def handleSubmodules(versionParam) {
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
println "init submodules..."
|
||||
sh 'git submodule update --init'
|
||||
if(isRelease(versionParam)) {
|
||||
|
|
@ -50,6 +51,7 @@ def handleSubmodules(versionParam) {
|
|||
println "setting netmodule submodule hashes to head..."
|
||||
sh 'git submodule update --remote --rebase meta-netmodule-*' // update our own submodules to HEAD
|
||||
}
|
||||
}
|
||||
submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
|
||||
println "${submoduleStatus}"
|
||||
writeFile(file: "${env.SUBMODULE_VERION_FILE}", text: "${submoduleStatus}")
|
||||
|
|
@ -111,8 +113,10 @@ def buildVersionString(imageType, actualBaseVersionString, versionParameter) {
|
|||
}
|
||||
|
||||
def getVersionString(versionParam, imageType) {
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
sh 'git fetch -ap'
|
||||
sh 'git fetch -t'
|
||||
}
|
||||
def gitCmd = "git describe --tags"
|
||||
|
||||
if(!isRelease(versionParam)) {
|
||||
|
|
|
|||
|
|
@ -75,8 +75,9 @@ def printJobParameters() {
|
|||
}
|
||||
|
||||
def prepareUpdate() {
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
sh 'git submodule update --init' // init submodules used if first checkout
|
||||
|
||||
}
|
||||
def userId = "${currentBuild.getBuildCauses()[0].userId}"
|
||||
def userName = "${currentBuild.getBuildCauses()[0].userName}"
|
||||
if("${userId}" == "null") {
|
||||
|
|
@ -93,12 +94,14 @@ def prepareUpdate() {
|
|||
}
|
||||
|
||||
def updateSubmodules(isNmUpdate, isCommunityUpdate) {
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
if(isNmUpdate) {
|
||||
sh(script: "git submodule update --remote --rebase meta-netmodule-*")
|
||||
}
|
||||
if(isCommunityUpdate) {
|
||||
sh(script: "git submodule update --remote --rebase \$(git submodule status | grep -v \"meta-netmodule-*\" | sed 's/^ *//g' | cut -d' ' -f2)")
|
||||
}
|
||||
}
|
||||
submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
|
||||
println "${submoduleStatus}"
|
||||
writeFile(file: "${env.SUBMODULE_VERSION_FILE}", text: "${submoduleStatus}")
|
||||
|
|
@ -128,7 +131,9 @@ def updateSourceRevisions(isNmUpdate) {
|
|||
|
||||
def commitSourceRevisionChanges() {
|
||||
println "commit source revision changes..."
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
sh(returnStdout: true, script: "./src-rev-commit.sh -b develop -v -l ./srcrev-commit.log")
|
||||
}
|
||||
sh "cat ./srcrev-commit.log >> ./${env.SOURCE_REVISION_UPDATE_LOG}"
|
||||
}
|
||||
|
||||
|
|
@ -147,5 +152,7 @@ def commitChanges(isNmUpdate, isCommunityUpdate) {
|
|||
println "everything up to date, nothing to commit"
|
||||
return
|
||||
}
|
||||
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||
sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes, triggered by ${env.TRIGGERED_USER}\" && git push")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue