This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a commit to branch kie-issues_755
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-operator.git
The following commit(s) were added to refs/heads/kie-issues_755 by this push:
new fed254ae kie-issues#755: initial adjustment for ASF jenkins
fed254ae is described below
commit fed254ae3941e10e1a54788ad1b876e96f288868
Author: jstastny-cz <[email protected]>
AuthorDate: Tue Dec 12 12:09:43 2023 +0100
kie-issues#755: initial adjustment for ASF jenkins
---
.ci/jenkins/Jenkinsfile | 22 +++++++++++++++-------
.ci/jenkins/Jenkinsfile.deploy | 8 ++++----
.ci/jenkins/Jenkinsfile.promote | 14 +++++++-------
.ci/jenkins/Jenkinsfile.setup-branch | 2 +-
.ci/jenkins/dsl/jobs.groovy | 14 ++++++++------
.ci/jenkins/scripts/helper.groovy | 10 +++++++---
6 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile b/.ci/jenkins/Jenkinsfile
index e6f1d6c9..8344ea8d 100644
--- a/.ci/jenkins/Jenkinsfile
+++ b/.ci/jenkins/Jenkinsfile
@@ -8,10 +8,10 @@ testsFailed = false
pipeline {
agent {
- label 'kogito-jenkins-node && !master' // Running on IBMCLoud jenkins,
no change to be done there
- }
- tools {
- go 'golang-1.17'
+ docker {
+ image env.AGENT_DOCKER_BUILDER_IMAGE
+ args env.AGENT_DOCKER_BUILDER_ARGS
+ }
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '',
artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')
@@ -30,9 +30,9 @@ pipeline {
script {
cleanGoPath()
- sh ' git config --global user.email "[email protected]" '
- sh ' git config --global user.name "kie user"'
-
githubscm.checkoutIfExists('incubator-kie-kogito-operator', changeAuthor,
changeBranch, 'apache', changeTarget, true, ['token' : 'GITHUB_TOKEN',
'usernamePassword' : 'user-kie-ci10'])
+ sh ' git config --global user.email
"[email protected]" '
+ sh ' git config --global user.name "Apache KIE user"'
+
githubscm.checkoutIfExists('incubator-kie-kogito-operator', changeAuthor,
changeBranch, 'apache', changeTarget, true, credentials = [token:
getGitAuthorTokenCredentialsId(), usernamePassword:
getGitAuthorCredentialsId()])
sh "set +x && oc login --token=\$(oc whoami -t)
--server=${OPENSHIFT_API} --insecure-skip-tls-verify"
}
}
@@ -158,3 +158,11 @@ String getBDDParameters() {
echo "BDD parameters = ${testParams}"
return testParams
}
+
+String getGitAuthorCredentialsId() {
+ return env.GIT_AUTHOR_CREDS_ID
+}
+
+String getGitAuthorTokenCredentialsId() {
+ return env.GIT_AUTHOR_TOKEN_CREDS_ID
+}
diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index a49693fe..c4514642 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -7,7 +7,7 @@ gitChanges = false
pipeline {
agent {
- docker {
+ docker {
image env.AGENT_DOCKER_BUILDER_IMAGE
args env.AGENT_DOCKER_BUILDER_ARGS
}
@@ -77,7 +77,7 @@ pipeline {
steps {
script {
if (githubscm.isBranchExist('origin',
helper.getPRBranch())) {
- githubscm.removeRemoteBranch('origin',
helper.getPRBranch())
+ githubscm.removeRemoteBranch('origin',
helper.getPRBranch(), helper.getGitAuthorPushCredsId())
}
githubscm.createBranch(helper.getPRBranch())
}
@@ -266,8 +266,8 @@ pipeline {
if (gitChanges) {
String prMsg = "[${helper.getBuildBranch()}] Update
version to ${helper.getProjectVersion()}"
def prBody = "Generated by build ${BUILD_TAG}:
${BUILD_URL}.\nPlease do not merge, it shoud be merged automatically."
- githubscm.pushObject('origin', helper.getPRBranch(),
helper.getGitAuthorCredsID())
- prLink = githubscm.createPR(prMsg, prBody,
helper.getBuildBranch(), helper.getGitAuthorCredsID())
+ githubscm.pushObject('origin', helper.getPRBranch(),
helper.getGitAuthorPushCredsId())
+ prLink = githubscm.createPR(prMsg, prBody,
helper.getBuildBranch(), helper.getGitAuthorCredsId())
properties.add("${helper.getRepoName()}.pr.link",
prLink)
properties.add("${helper.getRepoName()}.pr.source.uri",
"https://github.com/${helper.getGitAuthor()}/${helper.getRepoName()}")
diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote
index 698e86bd..a4e7300a 100644
--- a/.ci/jenkins/Jenkinsfile.promote
+++ b/.ci/jenkins/Jenkinsfile.promote
@@ -96,8 +96,8 @@ pipeline {
// Merge PR
String prLink =
properties.retrieve("${helper.getRepoName()}.pr.link")
if (prLink) {
- githubscm.mergePR(prLink,
helper.getGitAuthorCredsID())
- githubscm.pushObject('origin',
helper.getBuildBranch(), helper.getGitAuthorCredsID())
+ githubscm.mergePR(prLink,
helper.getGitAuthorPushCredsId())
+ githubscm.pushObject('origin',
helper.getBuildBranch(), helper.getGitAuthorPushCredsId())
}
}
}
@@ -108,11 +108,11 @@ pipeline {
steps {
script {
dir(helper.getRepoName()) {
- if (githubscm.isReleaseExist(helper.getGitTag(),
helper.getGitAuthorCredsID())) {
- githubscm.deleteReleaseAndTag(helper.getGitTag(),
helper.getGitAuthorCredsID())
+ if (githubscm.isReleaseExist(helper.getGitTag(),
helper.getGitAuthorCredsId())) {
+ githubscm.deleteReleaseAndTag(helper.getGitTag(),
helper.getGitAuthorPushCredsId())
}
-
githubscm.createReleaseWithGeneratedReleaseNotes(helper.getGitTag(),
helper.getBuildBranch(),
githubscm.getPreviousTagFromVersion(helper.getProjectVersion(), 'v'),
helper.getGitAuthorCredsID())
- githubscm.updateReleaseBody(helper.getGitTag(),
helper.getGitAuthorCredsID())
+
githubscm.createReleaseWithGeneratedReleaseNotes(helper.getGitTag(),
helper.getBuildBranch(),
githubscm.getPreviousTagFromVersion(helper.getProjectVersion(), 'v'),
helper.getGitAuthorPushCredsId())
+ githubscm.updateReleaseBody(helper.getGitTag(),
helper.getGitAuthorPushCredsId())
sh "make build-cli release=true
version=${helper.getProjectVersion()}"
def releasePath = 'build/_output/release/'
@@ -121,7 +121,7 @@ pipeline {
def linuxFileName = "${cliBaseName}-linux-amd64.tar.gz"
def windowsFileName =
"${cliBaseName}-windows-amd64.zip"
def yamlInstaller = 'kogito-operator.yaml'
- withCredentials([usernamePassword(credentialsId:
helper.getGitAuthorCredsID(), usernameVariable: 'GH_USER', passwordVariable:
'GH_TOKEN')]) {
+ withCredentials([usernamePassword(credentialsId:
helper.getGitAuthorPushCredsId(), usernameVariable: 'GH_USER',
passwordVariable: 'GH_TOKEN')]) {
sh """
gh release upload ${helper.getGitTag()}
"${releasePath}${darwinFileName}"
gh release upload ${helper.getGitTag()}
"${releasePath}${linuxFileName}"
diff --git a/.ci/jenkins/Jenkinsfile.setup-branch
b/.ci/jenkins/Jenkinsfile.setup-branch
index 2c71fdb7..baf43b2a 100644
--- a/.ci/jenkins/Jenkinsfile.setup-branch
+++ b/.ci/jenkins/Jenkinsfile.setup-branch
@@ -72,7 +72,7 @@ pipeline {
git add .
'''
})
- githubscm.pushObject('origin',
helper.getBuildBranch(), helper.getGitAuthorCredsID())
+ githubscm.pushObject('origin',
helper.getBuildBranch(), helper.getGitAuthorPushCredsId())
} else {
println '[WARN] no changes to commit'
}
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 50375ee4..15f49bd1 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -82,8 +82,8 @@ void createSetupBranchJob() {
jobParams.env.putAll([
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}",
IS_MAIN_BRANCH: "${Utils.isMainBranch(this)}"
])
@@ -114,8 +114,8 @@ void setupDeployJob(JobType jobType) {
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}",
DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}",
MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
@@ -189,8 +189,8 @@ void setupPromoteJob(JobType jobType) {
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}",
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
@@ -252,6 +252,8 @@ void setupExamplesImagesDeployJob(JobType jobType, String
jobName = 'kogito-exam
jobParams.env.putAll([
GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
+ GIT_AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
+
DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}",
MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
])
diff --git a/.ci/jenkins/scripts/helper.groovy
b/.ci/jenkins/scripts/helper.groovy
index 22d72e42..1e06d7db 100644
--- a/.ci/jenkins/scripts/helper.groovy
+++ b/.ci/jenkins/scripts/helper.groovy
@@ -65,7 +65,7 @@ void checkoutRepo(String repoName = '', String directory =
'') {
repoName = repoName ?: getRepoName()
closure = {
deleteDir()
- checkout(githubscm.resolveRepository(repoName, getGitAuthor(),
getBuildBranch(), false))
+ checkout(githubscm.resolveRepository(repoName, getGitAuthor(),
getBuildBranch(), false, getGitAuthorCredsId()))
// need to manually checkout branch since on a detached branch after
checkout command
sh "git checkout ${getBuildBranch()}"
}
@@ -246,8 +246,12 @@ String getGitAuthor() {
return "${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 getPRBranch() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]