Skip to content

Commit

Permalink
NO-ISSUE: isolate pr checks between branches
Browse files Browse the repository at this point in the history
  • Loading branch information
jstastny-cz authored and jstastny-cz committed Jul 23, 2024
1 parent c0949a7 commit 216cd7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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 216cd7c

Please sign in to comment.