This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a commit to branch main-kogito
in repository https://gitbox.apache.org/repos/asf/incubator-kie-docs.git
The following commit(s) were added to refs/heads/main-kogito by this push:
new 0a3679a0b kie-issues#767: set user config for git (#4534)
0a3679a0b is described below
commit 0a3679a0beaa33a54dcded8ae80afbbbb82589a1
Author: Jan Stastny <[email protected]>
AuthorDate: Thu Dec 14 12:13:56 2023 +0100
kie-issues#767: set user config for git (#4534)
Co-authored-by: jstastny-cz <[email protected]>
---
.ci/jenkins/Jenkinsfile.kie-kogito-post-release | 26 +++++++++++++++----------
.ci/jenkins/dsl/jobs.groovy | 3 ++-
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
b/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
index 59c4927b8..d7104a254 100644
--- a/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
+++ b/.ci/jenkins/Jenkinsfile.kie-kogito-post-release
@@ -38,7 +38,7 @@ pipeline {
script{
sh 'printenv'
dir(docsRepo){
- checkoutRepo(docsRepo, GIT_AUTHOR,
getDocsRepoBranch(), GIT_AUTHOR_CREDENTIALS_ID)
+ checkoutRepo(docsRepo, GIT_AUTHOR,
getDocsRepoBranch(), getGitAuthorCredsId())
}
}
}
@@ -83,6 +83,7 @@ pipeline {
dir("${docsRepo}/doc-content/kogito-docs") {
maven.mvnVersionsSet(parseVersion(getKogitoDocsVersion()))
if (githubscm.isThereAnyChanges()){
+
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg)
}
}
@@ -116,7 +117,7 @@ pipeline {
steps {
script {
dir("${docsRepo}/doc-content/kogito-docs") {
- githubscm.pushRemoteTag('origin',
"${getKogitoDocsVersion()}-kogito")
+ githubscm.pushRemoteTag('origin',
"${getKogitoDocsVersion()}-kogito", getGitAuthorPushCredsId())
}
}
}
@@ -154,7 +155,7 @@ pipeline {
String prLink = commitAndCreatePR(commitMsg,
PR_BRANCH, getDocsRepoBranch())
sh "git checkout ${getDocsRepoBranch()}"
mergeAndPush(prLink, getDocsRepoBranch())
- githubscm.removeRemoteBranch('origin', PR_BRANCH,
getGitAuthorCredsId())
+ githubscm.removeRemoteBranch('origin', PR_BRANCH,
getGitAuthorPushCredsId())
}
}
}
@@ -170,8 +171,8 @@ pipeline {
}
}
-void checkoutRepo(String repo, String GIT_AUTHOR, String branch, String
GIT_AUTHOR_CREDENTIALS_ID) {
- checkout(githubscm.resolveRepository(repo, GIT_AUTHOR, branch, false,
GIT_AUTHOR_CREDENTIALS_ID))
+void checkoutRepo(String repo, String gitAuthor, String branch, String
credsId) {
+ checkout(githubscm.resolveRepository(repo, gitAuthor, branch, false,
credsId))
// need to manually checkout branch since on a detached branch after
checkout command
sh "git checkout ${branch}"
}
@@ -219,7 +220,11 @@ boolean isNewVersionRequired() {
}
String getGitAuthorCredsId() {
- return env.GIT_AUTHOR_CREDENTIALS_ID
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorPushCredsId() {
+ return env.GIT_AUTHOR_PUSH_CREDS_ID
}
void sendErrorNotification() {
@@ -238,14 +243,15 @@ String parseCommunityVersion(String docVersion) {
void mergeAndPush(String prLink, String targetBranch) {
if (prLink?.trim()) {
- githubscm.mergePR(prLink, getGitAuthorCredsId())
- githubscm.pushObject('origin', targetBranch, getGitAuthorCredsId())
+ githubscm.mergePR(prLink, getGitAuthorPushCredsId())
+ githubscm.pushObject('origin', targetBranch, getGitAuthorPushCredsId())
}
}
String commitAndCreatePR(String commitMsg, String localBranch, String
targetBranch) {
def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}"
+ githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg)
- githubscm.pushObject('origin', localBranch, getGitAuthorCredsId())
- return githubscm.createPR(commitMsg, prBody, targetBranch,
getGitAuthorCredsId())
+ githubscm.pushObject('origin', localBranch, getGitAuthorPushCredsId())
+ return githubscm.createPR(commitMsg, prBody, targetBranch,
getGitAuthorPushCredsId())
}
\ No newline at end of file
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index c650da833..92fd7eeca 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -37,7 +37,8 @@ void setupKogitoDocsJob() {
jobParams.env.putAll([
JENKINS_EMAIL_CREDS_ID: "${JENKINS_EMAIL_CREDS_ID}",
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
- GIT_AUTHOR_CREDENTIALS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+ GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",
SSH_KOGITO_DOCS_PATH:
"[email protected]:/docs_htdocs/kogito/release",
RSYNC_KOGITO_DOCS_PATH:
"[email protected]:/docs_htdocs/kogito/release",
KIE_DOCS_BRANCH: 'main-kogito',
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]