This is an automated email from the ASF dual-hosted git repository.
tzimanyi pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-pipelines.git
The following commit(s) were added to refs/heads/main by this push:
new da32d41e kie-issues#600: set credentials for buildchain (#1103)
da32d41e is described below
commit da32d41e00d2914ab34c8e51027e4f83c6ece17e
Author: Jan Stastny <[email protected]>
AuthorDate: Wed Oct 4 15:34:36 2023 +0200
kie-issues#600: set credentials for buildchain (#1103)
Co-authored-by: jstastny-cz <[email protected]>
---
.ci/jenkins/config/branch.yaml | 1 +
dsl/seed/jenkinsfiles/Jenkinsfile.buildchain | 7 +++++--
dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy | 4 ++++
.../main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.ci/jenkins/config/branch.yaml b/.ci/jenkins/config/branch.yaml
index d1509a9f..248f1325 100644
--- a/.ci/jenkins/config/branch.yaml
+++ b/.ci/jenkins/config/branch.yaml
@@ -82,6 +82,7 @@ buildchain_config:
git:
repository: incubator-kie-kogito-pipelines
file_path: .ci/pull-request-config.yaml
+ token_credentials_id: kie-ci3-token
maven:
settings_file_id: kie-release-settings
nexus:
diff --git a/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
b/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
index ce3adbe4..9318bcc1 100644
--- a/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
+++ b/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
@@ -105,7 +105,7 @@ pipeline {
}
configFileProvider([configFile(fileId:
settingsXmlId, variable: 'MAVEN_SETTINGS_FILE')]) {
- withCredentials([string(credentialsId:
"${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}", variable: 'GITHUB_TOKEN')]) {
+ withCredentials([string(credentialsId:
"${BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID}", variable: 'GITHUB_TOKEN')]) {
env.BUILD_MVN_OPTS = "${env.BUILD_MVN_OPTS
?: ''} -s ${MAVEN_SETTINGS_FILE} -Dmaven.wagon.http.ssl.insecure=true
-Dmaven.test.failure.ignore=true"
echo "BUILD_MVN_OPTS = ${BUILD_MVN_OPTS}"
@@ -176,7 +176,7 @@ pipeline {
unsuccessful {
script {
if (isPRBuildChainType()) {
-
pullrequest.postComment(util.getMarkdownTestSummary(notificationJobName,
getReproducer(true), "${BUILD_URL}", 'GITHUB'),
"${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}")
+
pullrequest.postComment(util.getMarkdownTestSummary(notificationJobName,
getReproducer(true), "${BUILD_URL}", 'GITHUB'),
"${BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID}")
} else if (shouldNotify()) {
withCredentials([string(credentialsId:
"${JENKINS_EMAIL_CREDS_ID}", variable: 'KOGITO_CI_EMAIL_TO')]) {
mailer.sendMarkdownTestSummaryNotification(env.NOTIFICATION_JOB_NAME ?: '',
"[${env.GIT_BRANCH_NAME}] ${getRepoNameCamelCase(env.REPO_NAME)}",
[env.KOGITO_CI_EMAIL_TO], getReproducer())
@@ -184,6 +184,9 @@ pipeline {
}
}
}
+ cleanup {
+ cleanWs()
+ }
// cleanup {
// script {
// // Clean also docker in case of usage of testcontainers lib
diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy
b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy
index 91eb2612..c11b65f3 100644
--- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy
+++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy
@@ -211,6 +211,10 @@ class Utils {
return getBindingValue(script, 'BUILDCHAIN_CONFIG_GIT_FILE_PATH')
}
+ static String getBuildChainConfigTokenCredentialsId(def script) {
+ return getBindingValue(script,
'BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID')
+ }
+
static String getMavenArtifactsUploadRepositoryUrl(def script) {
return getBindingValue(script, 'MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL')
}
diff --git
a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy
b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy
index d1da98aa..c60317b4 100644
---
a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy
+++
b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy
@@ -144,8 +144,8 @@ class JobParamsUtils {
BUILDCHAIN_CONFIG_AUTHOR: Utils.getBuildChainConfigAuthor(script)
?: Utils.getSeedAuthor(script),
BUILDCHAIN_CONFIG_BRANCH: Utils.getBuildChainConfigBranch(script)
?: Utils.getSeedBranch(script),
BUILDCHAIN_CONFIG_FILE_PATH:
Utils.getBuildChainConfigFilePath(script),
+ BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID:
Utils.getBuildChainConfigTokenCredentialsId(script) ?:
Utils.getGitAuthorTokenCredsId(script),
NOTIFICATION_JOB_NAME: notificationJobName,
- GIT_AUTHOR_TOKEN_CREDENTIALS_ID:
Utils.getGitAuthorTokenCredsId(script),
])
addJobParamsEnvIfNotExisting(script, jobParams, 'BUILD_ENVIRONMENT',
jobParams.job.folder.getEnvironmentName())
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]