Skip to content

Commit 3e1a5c5

Browse files
committed
Fix git credentials in trigger jenkins job
1 parent 8a223af commit 3e1a5c5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

CompositeJenkinsfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ pipeline {
1717
build job: "${multiBranchJobPath}/${branchJobName}", wait: false
1818
} catch (e) {
1919
try {
20-
sh """
21-
git clone git@github.com:hivemq/hivemq.git --branch=${MASTER_BRANCH} --single-branch --depth 1 .
22-
git push origin HEAD:${BRANCH_NAME}
23-
"""
24-
} catch (e2) { // if push failed, branch already exists
20+
withCredentials([gitUsernamePassword(credentialsId: 'hivemq-jenkins')]) {
21+
sh("git clone https://github.com/hivemq/hivemq.git --branch=${MASTER_BRANCH} --single-branch --depth 1 .")
22+
try {
23+
sh("git push origin HEAD:${BRANCH_NAME}")
24+
} catch (e2) { // if push failed, branch already exists
25+
}
26+
}
2527
} finally {
2628
cleanWs()
2729
build job: multiBranchJobPath, wait: false

0 commit comments

Comments
 (0)