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,15 +40,17 @@ def isRelease(versionParam) {
|
||||||
|
|
||||||
|
|
||||||
def handleSubmodules(versionParam) {
|
def handleSubmodules(versionParam) {
|
||||||
println "init submodules..."
|
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||||
sh 'git submodule update --init'
|
println "init submodules..."
|
||||||
if(isRelease(versionParam)) {
|
sh 'git submodule update --init'
|
||||||
println "set submodules to freezed state..."
|
if(isRelease(versionParam)) {
|
||||||
sh 'git submodule update' // set all submodules to freezed commit
|
println "set submodules to freezed state..."
|
||||||
}
|
sh 'git submodule update' // set all submodules to freezed commit
|
||||||
else {
|
}
|
||||||
println "setting netmodule submodule hashes to head..."
|
else {
|
||||||
sh 'git submodule update --remote --rebase meta-netmodule-*' // update our own submodules to HEAD
|
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
|
submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
|
||||||
println "${submoduleStatus}"
|
println "${submoduleStatus}"
|
||||||
|
|
@ -111,8 +113,10 @@ def buildVersionString(imageType, actualBaseVersionString, versionParameter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
def getVersionString(versionParam, imageType) {
|
def getVersionString(versionParam, imageType) {
|
||||||
sh 'git fetch -ap'
|
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||||
sh 'git fetch -t'
|
sh 'git fetch -ap'
|
||||||
|
sh 'git fetch -t'
|
||||||
|
}
|
||||||
def gitCmd = "git describe --tags"
|
def gitCmd = "git describe --tags"
|
||||||
|
|
||||||
if(!isRelease(versionParam)) {
|
if(!isRelease(versionParam)) {
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,9 @@ def printJobParameters() {
|
||||||
}
|
}
|
||||||
|
|
||||||
def prepareUpdate() {
|
def prepareUpdate() {
|
||||||
sh 'git submodule update --init' // init submodules used if first checkout
|
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 userId = "${currentBuild.getBuildCauses()[0].userId}"
|
||||||
def userName = "${currentBuild.getBuildCauses()[0].userName}"
|
def userName = "${currentBuild.getBuildCauses()[0].userName}"
|
||||||
if("${userId}" == "null") {
|
if("${userId}" == "null") {
|
||||||
|
|
@ -93,11 +94,13 @@ def prepareUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
def updateSubmodules(isNmUpdate, isCommunityUpdate) {
|
def updateSubmodules(isNmUpdate, isCommunityUpdate) {
|
||||||
if(isNmUpdate) {
|
sshagent (credentials: ['7767e711-08a4-4c71-b080-197253dd7392']) {
|
||||||
sh(script: "git submodule update --remote --rebase meta-netmodule-*")
|
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)")
|
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
|
submoduleStatus = sh(returnStdout: true, script: "git submodule status").trim() // print submodule hashes to jenkins log
|
||||||
println "${submoduleStatus}"
|
println "${submoduleStatus}"
|
||||||
|
|
@ -128,7 +131,9 @@ def updateSourceRevisions(isNmUpdate) {
|
||||||
|
|
||||||
def commitSourceRevisionChanges() {
|
def commitSourceRevisionChanges() {
|
||||||
println "commit source revision changes..."
|
println "commit source revision changes..."
|
||||||
sh(returnStdout: true, script: "./src-rev-commit.sh -b develop -v -l ./srcrev-commit.log")
|
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}"
|
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"
|
println "everything up to date, nothing to commit"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sh(script: "git commit -m \"submodules: updated ${updatedLayers} hashes, triggered by ${env.TRIGGERED_USER}\" && git push")
|
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