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-kogito-apps.git
The following commit(s) were added to refs/heads/main by this push:
new e3abf2cf6 kie-issues#727: define push GH tokens for jenkins (#1928)
e3abf2cf6 is described below
commit e3abf2cf6555b2152b3f18f56edda3744595f668
Author: Jan Stastny <[email protected]>
AuthorDate: Fri Dec 1 08:06:35 2023 +0100
kie-issues#727: define push GH tokens for jenkins (#1928)
Co-authored-by: jstastny-cz <[email protected]>
---
.ci/jenkins/Jenkinsfile.deploy | 12 +++++------
.ci/jenkins/Jenkinsfile.promote | 24 +++++++++++++---------
.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr | 10 ++++++---
.../Jenkinsfile.quarkus-3.rewrite.standalone | 10 ++++++---
.ci/jenkins/Jenkinsfile.setup-branch | 12 +++++++----
.ci/jenkins/dsl/jobs.groovy | 17 ++++++++-------
6 files changed, 52 insertions(+), 33 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 5ca168f4d..34664e57d 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -76,7 +76,7 @@ pipeline {
script {
dir(getRepoName()) {
if (githubscm.isBranchExist('origin',getPRBranch())) {
- githubscm.removeRemoteBranch('origin',
getPRBranch())
+ githubscm.removeRemoteBranch('origin',
getPRBranch(), getGitAuthorPushCredsId())
}
githubscm.createBranch(getPRBranch())
}
@@ -206,7 +206,7 @@ void saveReports() {
void checkoutRepo() {
deleteDir()
- checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(),
getBuildBranch(), false))
+ checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(),
getBuildBranch(), false, getGitAuthorCredsId()))
}
void commitAndCreatePR() {
@@ -218,8 +218,8 @@ void commitAndCreatePR() {
prBody += '\nPlease review and merge.'
}
githubscm.commitChanges(commitMsg, {
githubscm.findAndStageNotIgnoredFiles('pom.xml') })
- githubscm.pushObject('origin', getPRBranch(), getGitAuthorCredsID())
- deployProperties["${getRepoName()}.pr.link"] =
githubscm.createPRWithLabels(commitMsg, prBody, getBuildBranch(), ['skip-ci']
as String[], getGitAuthorCredsID())
+ githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId())
+ deployProperties["${getRepoName()}.pr.link"] =
githubscm.createPRWithLabels(commitMsg, prBody, getBuildBranch(), ['skip-ci']
as String[], getGitAuthorCredsId())
}
boolean isSpecificArtifactsUpload() {
@@ -251,8 +251,8 @@ String getGitAuthor() {
return "${GIT_AUTHOR}"
}
-String getGitAuthorCredsID() {
- return env.AUTHOR_CREDS_ID
+String getGitAuthorCredsId() {
+ return env.GIT_AUTHOR_CREDS_ID
}
String getBuildBranch() {
diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index fdcc0f8ef..62804e64c 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -56,11 +56,11 @@ pipeline {
script {
dir(getRepoName()) {
checkoutRepo()
- if (githubscm.isReleaseExist(getGitTag(),
getGitAuthorCredsID())) {
- githubscm.deleteRelease(getGitTag(),
getGitAuthorCredsID())
+ if (githubscm.isReleaseExist(getGitTag(),
getGitAuthorCredsId())) {
+ githubscm.deleteRelease(getGitTag(),
getGitAuthorCredsId())
}
-
githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(),
githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorCredsID())
- githubscm.updateReleaseBody(getGitTag(),
getGitAuthorCredsID())
+
githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(),
githubscm.getPreviousTagFromVersion(getGitTag()), getGitAuthorCredsId())
+ githubscm.updateReleaseBody(getGitTag(),
getGitAuthorCredsId())
}
}
}
@@ -145,8 +145,12 @@ String getGitAuthor() {
return env.GIT_AUTHOR
}
-String getGitAuthorCredsID() {
- return env.AUTHOR_CREDS_ID
+String getGitAuthorCredsId() {
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
String getDeployPrLink() {
@@ -159,20 +163,20 @@ String getDeployPrLink() {
void checkoutRepo() {
deleteDir()
- checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(),
getBuildBranch(), false))
+ checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(),
getBuildBranch(), false, getGitAuthorCredsId()))
// need to manually checkout branch since on a detached branch after
checkout command
sh "git checkout ${getBuildBranch()}"
}
void mergeAndPush(String prLink) {
if (prLink) {
- githubscm.mergePR(prLink, getGitAuthorCredsID())
- githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID())
+ githubscm.mergePR(prLink, getGitAuthorCredsId())
+ githubscm.pushObject('origin', getBuildBranch(),
getGitAuthorPushCredsId())
}
}
void tagLatest() {
if (getGitTag()) {
- githubscm.tagLocalAndRemoteRepository('origin', getGitTag(),
getGitAuthorCredsID(), env.BUILD_TAG, true)
+ githubscm.tagLocalAndRemoteRepository('origin', getGitTag(),
getGitAuthorPushCredsId(), env.BUILD_TAG, true)
}
}
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
index d1c3e0e49..73e25a9eb 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.pr
@@ -27,7 +27,7 @@ pipeline {
archiveArtifacts artifacts: 'env_props'
dir(getRepoName()) {
- checkout(githubscm.resolveRepository(getRepoName(),
changeAuthor, changeBranch, false))
+ checkout(githubscm.resolveRepository(getRepoName(),
changeAuthor, changeBranch, false, getGitAuthorCredsId()))
// need to manually checkout branch since on a
detached branch after checkout command
sh "git checkout ${changeBranch}"
}
@@ -70,7 +70,7 @@ pipeline {
steps {
script {
dir(getRepoName()) {
- githubscm.pushObject('origin', changeBranch,
getGitAuthorCredsId())
+ githubscm.pushObject('origin', changeBranch,
getGitAuthorPushCredsId())
}
}
}
@@ -93,7 +93,11 @@ String getRepoName() {
}
String getGitAuthorCredsId() {
- return env.AUTHOR_CREDS_ID
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
MavenCommand getMavenCommand() {
diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
index 5fd9f04ae..6c8fe19e6 100644
--- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
+++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone
@@ -88,7 +88,7 @@ pipeline {
steps {
script {
dir(getRepoName()) {
- githubscm.pushObject('origin', isPRSourceBranch() ?
getBuildBranch() : getPRBranch(), getGitAuthorCredsId())
+ githubscm.pushObject('origin', isPRSourceBranch() ?
getBuildBranch() : getPRBranch(), getGitAuthorPushCredsId())
}
}
}
@@ -139,7 +139,7 @@ void sendNotification(String body) {
}
void checkoutRepo(String repository, String branch) {
- checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch,
false))
+ checkout(githubscm.resolveRepository(repository, getGitAuthor(), branch,
false, getGitAuthorCredsId()))
// need to manually checkout branch since on a detached branch after
checkout command
sh "git checkout ${branch}"
}
@@ -170,7 +170,11 @@ boolean isPRSourceBranch() {
}
String getGitAuthorCredsId() {
- return env.AUTHOR_CREDS_ID
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
String getPRBranch() {
diff --git a/.ci/jenkins/Jenkinsfile.setup-branch
b/.ci/jenkins/Jenkinsfile.setup-branch
index 21ffbcf18..3978a696e 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -88,7 +88,7 @@ pipeline {
def commitMsg = "Update version to
${getKogitoVersion()}"
githubscm.commitChanges(commitMsg, {
githubscm.findAndStageNotIgnoredFiles('pom.xml') })
- githubscm.pushObject('origin', getBuildBranch(),
getGitAuthorCredsID())
+ githubscm.pushObject('origin', getBuildBranch(),
getGitAuthorPushCredsId())
} else {
println '[WARN] no changes to commit'
}
@@ -120,7 +120,7 @@ void sendNotification() {
void checkoutRepo(String repository, String branch) {
dir(repository) {
deleteDir()
- checkout(githubscm.resolveRepository(repository, getGitAuthor(),
branch, false))
+ checkout(githubscm.resolveRepository(repository, getGitAuthor(),
branch, false, getGitAuthorCredsId()))
// need to manually checkout branch since on a detached branch after
checkout command
sh "git checkout ${branch}"
}
@@ -155,8 +155,12 @@ String getKogitoVersion() {
return params.KOGITO_VERSION
}
-String getGitAuthorCredsID() {
- return env.AUTHOR_CREDS_ID
+String getGitAuthorCredsId() {
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
MavenCommand getMavenCommand(String directory) {
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 5e55efe50..fb21019bf 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -202,7 +202,8 @@ void createSetupBranchJob() {
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
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}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
@@ -228,8 +229,8 @@ void setupReleaseDeployJob() {
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
- AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
- GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}",
+ GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
@@ -268,8 +269,8 @@ void setupReleasePromoteJob() {
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
- AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
- GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}",
+ GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
@@ -306,7 +307,8 @@ void setupPrQuarkus3RewriteJob() {
commitContext: 'Quarkus 3 rewrite',
])
jobParams.env.putAll([
- 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}",
MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}",
])
KogitoJobTemplate.createPRJob(this, jobParams)
@@ -317,7 +319,8 @@ void setupStandaloneQuarkus3RewriteJob() {
jobParams.env.putAll(EnvUtils.getEnvironmentEnvVars(this, 'quarkus-3'))
JobParamsUtils.setupJobParamsAgentDockerBuilderImageConfiguration(this,
jobParams)
jobParams.env.putAll([
- 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}",
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
BASE_BRANCH: Utils.getGitBranch(this),
BASE_AUTHOR: Utils.getGitAuthor(this),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]