Skip to content

Commit 50386f7

Browse files
committed
jenkins > improve Jenkinsfile
1 parent 33caa04 commit 50386f7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

CompositeJenkinsfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
PLATFORM_MASTER = 'master-4.5'
1+
MASTER_BRANCH = 'master-4.5'
22

33
pipeline {
4-
// by default run on the master node, since it's the only one with direct repo access
54
agent { label 'master' }
65
options {
76
skipDefaultCheckout() // no checkout needed
@@ -12,19 +11,20 @@ pipeline {
1211
stage('Trigger build') {
1312
steps {
1413
script {
14+
def multiBranchJobPath = '../../hivemq4-composite'
1515
def branchJobName = BRANCH_NAME.replace('/', '%2F')
1616
try {
17-
build job: "../../hivemq4-composite/${branchJobName}", wait: false
17+
build job: "${multiBranchJobPath}/${branchJobName}", wait: false
1818
} catch (e) {
1919
try {
2020
sh """
21-
git clone git@github.com:hivemq/hivemq.git --branch=${PLATFORM_MASTER} --single-branch --depth 1 .
21+
git clone git@github.com:hivemq/hivemq.git --branch=${MASTER_BRANCH} --single-branch --depth 1 .
2222
git push origin HEAD:${BRANCH_NAME}
2323
"""
2424
} catch (e2) { // if push failed, branch already exists
2525
} finally {
2626
cleanWs()
27-
build job: "../../hivemq4-composite", wait: false
27+
build job: multiBranchJobPath, wait: false
2828
}
2929
}
3030
}

0 commit comments

Comments
 (0)