Skip to content

Commit

Permalink
[10.0.x] isolate pr checks between branches (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstastny-cz committed Jul 22, 2024
1 parent 385d454 commit 6513ba1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
File renamed without changes.
8 changes: 7 additions & 1 deletion .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 6513ba1

Please sign in to comment.