This is an automated email from the ASF dual-hosted git repository.

jstastnycz pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-images.git

commit 6dce73d44df5518a4ba69669cce27c8a874187e9
Author: Jan Stastny <[email protected]>
AuthorDate: Tue Jul 23 01:18:15 2024 +0200

    NO-ISSUE: isolate pr checks between branches
---
 .ci/jenkins/Jenkinsfile.setup-branch | 8 +++++++-
 .ci/jenkins/dsl/jobs.groovy          | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.setup-branch 
b/.ci/jenkins/Jenkinsfile.setup-branch
index ade24b15..e6d5b102 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -103,8 +103,14 @@ pipeline {
             steps {
                 script {
                     dir(getRepoName()) {
+                        
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
+                        def mainBranchPrCheckJenkinsfile = 
'.ci/jenkins/Jenkinsfile'
+                        def newBranchPrCheckJenkinsfile = 
".ci/jenkins/Jenkinsfile.pr.${getBuildBranch()}"
+                        if (!isMainBranch() && 
fileExists(mainBranchPrCheckJenkinsfile)) {
+                            sh "mv ${mainBranchPrCheckJenkinsfile} 
${newBranchPrCheckJenkinsfile}"
+                            sh "git add ${newBranchPrCheckJenkinsfile}"
+                        }
                         if (githubscm.isThereAnyChanges()) {
-                            
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
                             githubscm.commitChanges("[${getBuildBranch()}] 
Update version to ${getKogitoVersion()}")
                             githubscm.pushObject('origin', getBuildBranch(), 
getGitAuthorPushCredsId())
                         } else {
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index c3eb80a0..526ad313 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -64,7 +64,8 @@ void setupPrJob() {
     setupBuildAndTestJob(JobType.PULL_REQUEST)
 
     // Branch Source Plugin multibranchPipelineJob
-    Utils.isMainBranch(this) && 
KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, 
"${jenkins_path}/Jenkinsfile", JobType.PULL_REQUEST.getName())
+    def triggeringJenkinsfileName = Utils.isMainBranch(this) ? "Jenkinsfile" : 
"Jenkinsfile.pr.${Utils.getGitBranch(this)}"
+    KogitoJobTemplate.createPullRequestMultibranchPipelineJob(this, 
"${jenkins_path}/${triggeringJenkinsfileName}", JobType.PULL_REQUEST.getName())
 }
 
 void createSetupBranchJob() {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to