From 5bd30a70f1927a9a8a28fb65aa95bb13c7955175 Mon Sep 17 00:00:00 2001 From: Alexandre Bard Date: Wed, 27 Sep 2023 17:30:52 +0200 Subject: [PATCH] update-src-revision: Overwrite nightly branch This branch is reserved for that and may not be merged every day. We want to overwrite anyway everynight with the latest changes. --- jobs/Jenkinsfile_UpdateSrcRevisions | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/jobs/Jenkinsfile_UpdateSrcRevisions b/jobs/Jenkinsfile_UpdateSrcRevisions index 9bb860e..faa2f32 100644 --- a/jobs/Jenkinsfile_UpdateSrcRevisions +++ b/jobs/Jenkinsfile_UpdateSrcRevisions @@ -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" @@ -151,7 +139,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 +146,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}"