This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-benchmarks.git
The following commit(s) were added to refs/heads/main by this push:
new cd23128c kie-issues#727: define push GH tokens for jenkins
cd23128c is described below
commit cd23128cd4b0cdf208cf078830a8cffba9ff44d9
Author: jstastny-cz <[email protected]>
AuthorDate: Tue Nov 28 13:36:54 2023 +0100
kie-issues#727: define push GH tokens for jenkins
---
.ci/jenkins/Jenkinsfile.branch | 12 ++++++++++--
.ci/jenkins/Jenkinsfile.bump-up-version | 15 ++++++++++-----
.ci/jenkins/dsl/jobs.groovy | 3 ++-
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.branch b/.ci/jenkins/Jenkinsfile.branch
index 8d3c792e..867711bc 100644
--- a/.ci/jenkins/Jenkinsfile.branch
+++ b/.ci/jenkins/Jenkinsfile.branch
@@ -47,7 +47,7 @@ pipeline {
steps {
dir("${WORKSPACE}/${benchmarksRepo}") {
script {
- githubscm.pushObject('origin', NEW_BRANCH)
+ githubscm.pushObject('origin', NEW_BRANCH,
getGitAuthorPushCredsId())
}
}
}
@@ -62,6 +62,14 @@ pipeline {
void checkoutKieBenchmarksRepo() {
dir(benchmarksRepo) {
- checkout(githubscm.resolveRepository(benchmarksRepo, GIT_AUTHOR,
TARGET_BRANCH, false))
+ checkout(githubscm.resolveRepository(benchmarksRepo, GIT_AUTHOR,
TARGET_BRANCH, false, getGitAuthorCredsId()))
}
}
+
+String getGitAuthorCredsId() {
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
+}
diff --git a/.ci/jenkins/Jenkinsfile.bump-up-version
b/.ci/jenkins/Jenkinsfile.bump-up-version
index 471254f7..52ce6925 100644
--- a/.ci/jenkins/Jenkinsfile.bump-up-version
+++ b/.ci/jenkins/Jenkinsfile.bump-up-version
@@ -46,7 +46,7 @@ pipeline {
String prLink = commitAndCreatePR(commitMsg,
localBranch, "${getTargetBranch()}")
sh "git checkout ${getTargetBranch()}"
mergeAndPush(prLink, "${getTargetBranch()}")
- githubscm.removeRemoteBranch('origin', localBranch,
getGitAuthorCredsId())
+ githubscm.removeRemoteBranch('origin', localBranch,
getGitAuthorPushCredsId())
}
}
}
@@ -73,7 +73,11 @@ String getGitAuthor() {
}
String getGitAuthorCredsId() {
- return env.AUTHOR_CREDS_ID
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
String getTargetBranch() {
@@ -89,13 +93,14 @@ void checkoutRepo(String repository, String branch) {
String commitAndCreatePR(String commitMsg, String localBranch, String
targetBranch) {
def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}"
githubscm.commitChanges(commitMsg)
- githubscm.pushObject('origin', localBranch, getGitAuthorCredsId())
+ githubscm.pushObject('origin', localBranch, getGitAuthorPushCredsId())
return githubscm.createPR(commitMsg, prBody,
targetBranch,getGitAuthorCredsId())
}
void mergeAndPush(String prLink, String targetBranch) {
if (prLink?.trim()) {
githubscm.mergePR(prLink, getGitAuthorCredsId())
- githubscm.pushObject('origin', targetBranch, getGitAuthorCredsId())
+ githubscm.pushObject('origin', targetBranch, getGitAuthorPushCredsId())
}
-}
\ No newline at end of file
+}
+
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 95897990..53e753ee 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -34,7 +34,8 @@ void setupUpdateDependencyJob(String updateRepoName) {
UPDATE_REPO_NAME: "${updateRepoName}",
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
- AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]