diff --git a/.ci/jenkins/config/branch.yaml b/.ci/jenkins/config/branch.yaml index d1509a9fa..248f13250 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 ce3adbe43..9318bcc14 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 91eb26124..c11b65f35 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 d1da98aa2..c60317b41 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()) }