Skip to content

Commit

Permalink
Fix Setup Branch pipeline (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste authored Sep 4, 2023
1 parent 5fdfd79 commit a929918
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions .ci/jenkins/Jenkinsfile.setup-branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import org.jenkinsci.plugins.workflow.libs.Library

import org.kie.jenkins.MavenCommand

droolsRepo = 'drools'

pipeline {
agent {
label 'kie-rhel8 && !built-in'
Expand Down Expand Up @@ -32,8 +34,21 @@ pipeline {
if (params.DISPLAY_NAME) {
currentBuild.displayName = params.DISPLAY_NAME
}
dir(getRepoName()) {
checkoutRepo(getRepoName(), getBuildBranch())

checkoutRepo(droolsRepo, getBuildBranch())
checkoutRepo(getRepoName(), getBuildBranch())
}
}
}
stage('Build Drools') {
steps {
script {
dir(droolsRepo) {
getMavenCommand()
.withOptions(env.BUILD_MVN_OPTS_UPSTREAM ? [ env.BUILD_MVN_OPTS_UPSTREAM ] : [])
.withOptions(env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ? [ env.DROOLS_BUILD_MVN_OPTS_UPSTREAM ] : [])
.withProperty('quickly')
.run('clean install')
}
}
}
Expand All @@ -42,7 +57,7 @@ pipeline {
steps {
script {
dir(getRepoName()) {
maven.mvnVersionsUpdateParentAndChildModules(getMavenCommand(), getDroolsVersion(), !isRelease())
maven.mvnVersionsUpdateParentAndChildModules(getMavenCommand(), getDroolsVersion(), true)
}
}
}
Expand Down Expand Up @@ -88,9 +103,11 @@ void sendNotification() {
}

void checkoutRepo(String repository, String branch) {
checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false))
// need to manually checkout branch since on a detached branch after checkout command
sh "git checkout ${branch}"
dir(repository) {
checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch, false))
// need to manually checkout branch since on a detached branch after checkout command
sh "git checkout ${branch}"
}
}

String getRepoName() {
Expand Down

0 comments on commit a929918

Please sign in to comment.