|
|
|
|
@ -91,18 +91,6 @@ def updateTheSourceRevisions(commonHelpers, repoDir, theBranch) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
def setupNewBranchAndGetGitPushPostfix(theNewBranch) {
|
|
|
|
|
if(sh(returnStatus: true, script: "git checkout ${theNewBranch}") == 0) {
|
|
|
|
|
println "----------------------------------------------------\n\
|
|
|
|
|
NOTE: Branch ${theNewBranch} already available \n\
|
|
|
|
|
and potentially as well a pull/merge request.\n\
|
|
|
|
|
--> handle this branch and request first\n----------------------------------------------------"
|
|
|
|
|
error("Available branch ${theNewBranch} detected --> handle this first")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sh(script: "git checkout -b ${theNewBranch}")
|
|
|
|
|
}
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
def createPR(theBranch) {
|
|
|
|
|
def prReviewer = "bard"
|
|
|
|
|
def prProject = "NM-NSP"
|
|
|
|
|
@ -129,6 +117,12 @@ def createPR(theBranch) {
|
|
|
|
|
--header '${acceptHeader}' \
|
|
|
|
|
--header '${contentHeader}' \
|
|
|
|
|
--data '${prDataJson}'").toString()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// It is okay if the pull request already exists: we can ignore the error
|
|
|
|
|
if(prResponse.contains("DuplicatePullRequestException"))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if(prResponse.contains("error")) {
|
|
|
|
|
error("Failed creating PR/MR:\n${prResponse}")
|
|
|
|
|
}
|
|
|
|
|
@ -151,7 +145,6 @@ def commitAndPushTheChanges(commonHelpers, repoDir, origBranch) {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
def theCredentials = commonHelpers.getGitCredentialID()
|
|
|
|
|
setupNewBranchAndGetGitPushPostfix("${nightlyBranch}")
|
|
|
|
|
println "Commit and Push changes; message = '${commitMsg}'\nchanges = ${changedItems}"
|
|
|
|
|
sshagent (credentials: [theCredentials]) {
|
|
|
|
|
// ToDo: replace the user.email and user.name once a CI user is setup in the
|
|
|
|
|
@ -159,8 +152,9 @@ def commitAndPushTheChanges(commonHelpers, repoDir, origBranch) {
|
|
|
|
|
sh(label: "Commit and push changes", returnStdout: true, script: """
|
|
|
|
|
git config --global user.email "marc.mattmueller@netmodule.com"
|
|
|
|
|
git config --global user.name "Marc Mattm\u00fcller"
|
|
|
|
|
git checkout -B ${nightlyBranch}
|
|
|
|
|
git commit -m "${commitMsg}"
|
|
|
|
|
git push -u origin ${nightlyBranch}
|
|
|
|
|
git push --force --set-upstream origin ${nightlyBranch}
|
|
|
|
|
""")
|
|
|
|
|
}
|
|
|
|
|
usedBranch = "${nightlyBranch}"
|
|
|
|
|
|