diff --git a/.ci/jenkins/Jenkinsfile.post-release b/.ci/jenkins/Jenkinsfile.post-release index 1881d79e9..67af5de62 100644 --- a/.ci/jenkins/Jenkinsfile.post-release +++ b/.ci/jenkins/Jenkinsfile.post-release @@ -57,7 +57,7 @@ pipeline { script { dir("kogito-docs-${getBuildBranch()}") { deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsID())) + checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) sh "git checkout ${getBuildBranch()}" String antoraFile = 'serverlessworkflow/antora.yml' @@ -70,14 +70,15 @@ pipeline { // Add changed files, commit, open and merge PR if (githubscm.isThereAnyChanges()) { + githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) githubscm.commitChanges("Release Kogito ${getKogitoVersion()}") - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) } else { echo "No changes to push." } // Tag repository - githubscm.tagLocalAndRemoteRepository('origin', getKogitoVersion(), getGitAuthorCredsID(), env.BUILD_TAG, true) + githubscm.tagLocalAndRemoteRepository('origin', getKogitoVersion(), getGitAuthorCredsId(), env.BUILD_TAG, true) } } } @@ -126,6 +127,9 @@ 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 } diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index 3c2b20b5d..0a193c867 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -60,7 +60,7 @@ pipeline { dir("kogito-docs-${getBuildBranch()}") { deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsID())) + checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId())) sh "git checkout ${getBuildBranch()}" String[] branchSplit = getBuildBranch().split("\\.") @@ -81,8 +81,9 @@ pipeline { // Add changed files, commit, open and merge PR if (githubscm.isThereAnyChanges()) { + githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) githubscm.commitChanges("Init ${getBuildBranch()} branch") - githubscm.pushObject('origin', getBuildBranch(), getGitAuthorCredsID()) + githubscm.pushObject('origin', getBuildBranch(), getGitAuthorPushCredsId()) } else { echo 'No changes to push.' } @@ -96,7 +97,7 @@ pipeline { script { dir('kogito-docs') { deleteDir() - checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), 'main', false, getGitAuthorCredsID())) + checkout(githubscm.resolveRepository('incubator-kie-kogito-docs', getGitAuthor(), 'main', false, getGitAuthorCredsId())) sh 'git checkout main' updateYaml('antora-playbook.yml') { antoraConfig -> @@ -110,8 +111,9 @@ pipeline { // Add changed files, commit, open and merge PR if (githubscm.isThereAnyChanges()) { + githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId()) githubscm.commitChanges("Add branch ${getBuildBranch()} for generation") - githubscm.pushObject('origin', 'main', getGitAuthorCredsID()) + githubscm.pushObject('origin', 'main', getGitAuthorPushCredsId()) } else { echo 'No changes to push.' } @@ -153,8 +155,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 } void updateYaml(String filePath, Closure updateClosure) { diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index fec5bb77a..85d116706 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -58,7 +58,9 @@ void createSetupBranchJob() { 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}", IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}" ]) @@ -80,7 +82,9 @@ void setupPostReleaseJob() { 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 {