Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

KOGITO-9671 CI: Remove bot account usage #1503

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {

JAVA_HOME = "${GRAALVM_HOME}"

BOT_BRANCH_HASH = "${util.generateHash(10)}"
PR_BRANCH_HASH = "${util.generateHash(10)}"

// Environment required by OLM tests when run from process
OP_TEST_CONTAINER_OPT = '-t'
Expand Down Expand Up @@ -87,8 +87,7 @@ pipeline {
}
steps {
script {
githubscm.forkRepo(helper.getBotAuthorCredsID())
githubscm.createBranch(helper.getBotBranch())
githubscm.createBranch(helper.getPRBranch())
}
}
}
Expand Down Expand Up @@ -275,12 +274,12 @@ 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.getBotBranch(), helper.getBotAuthorCredsID())
prLink = githubscm.createPR(prMsg, prBody, helper.getBuildBranch(), helper.getBotAuthorCredsID())
githubscm.pushObject('origin', helper.getPRBranch(), helper.getGitAuthorCredsID())
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.getBotAuthor()}/${helper.getRepoName()}")
properties.add("${helper.getRepoName()}.pr.source.ref", helper.getBotBranch())
properties.add("${helper.getRepoName()}.pr.source.uri", "https://github.com/${helper.getGitAuthor()}/${helper.getRepoName()}")
properties.add("${helper.getRepoName()}.pr.source.ref", helper.getPRBranch())
properties.add("${helper.getRepoName()}.pr.target.uri", "https://github.com/${helper.getGitAuthor()}/${helper.getRepoName()}")
properties.add("${helper.getRepoName()}.pr.target.ref", helper.getBuildBranch())
} else {
Expand Down
3 changes: 1 addition & 2 deletions .ci/jenkins/Jenkinsfile.examples-images.promote
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pipeline {
CONTAINER_ENGINE = 'podman'
CONTAINER_TLS_OPTIONS = '--tls-verify=false'

BOT_BRANCH_HASH = "${util.generateHash(10)}"
GITHUB_REPO = "${REPO_NAME}" // for github-release cli
}

Expand All @@ -34,7 +33,7 @@ pipeline {
steps {
script {
helper.cleanGoPath()

helper.updateDisplayName()

properties.readFromUrl(helper.getDeployPropertiesFileUrl())
Expand Down
9 changes: 4 additions & 5 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pipeline {
CONTAINER_ENGINE = 'podman'
CONTAINER_TLS_OPTIONS = '--tls-verify=false'

BOT_BRANCH_HASH = "${util.generateHash(10)}"
PR_BRANCH_HASH = "${util.generateHash(10)}"
GITHUB_REPO = "${REPO_NAME}" // for github-release cli
}

Expand Down Expand Up @@ -125,10 +125,9 @@ pipeline {
String prLink = ''
String nextVersion = helper.getNextVersion()
String snapshotBranch = helper.getSnapshotBranch()
dir('bot') {
dir('pr') {
// Prepare PR
helper.checkoutRepo()
githubscm.forkRepo(helper.getBotAuthorCredsID())
githubscm.createBranch(snapshotBranch)

// Update version to next snapshot
Expand All @@ -143,8 +142,8 @@ pipeline {
git reset -- go.sum
'''
})
githubscm.pushObject('origin', snapshotBranch, helper.getBotAuthorCredsID())
prLink = githubscm.createPR(commitMsg, prBody, helper.getBuildBranch(), helper.getBotAuthorCredsID())
githubscm.pushObject('origin', snapshotBranch, helper.getGitAuthorCredsID())
prLink = githubscm.createPR(commitMsg, prBody, helper.getBuildBranch(), helper.getGitAuthorCredsID())
}
dir(helper.getRepoName()) {
if (prLink) {
Expand Down
4 changes: 0 additions & 4 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ void setupDeployJob(JobType jobType, String envName = '') {

AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}",
GIT_AUTHOR_BOT: "${GIT_BOT_AUTHOR_NAME}",
BOT_CREDENTIALS_ID: "${GIT_BOT_AUTHOR_CREDENTIALS_ID}",

DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}",
MAVEN_ARTIFACT_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
Expand Down Expand Up @@ -191,8 +189,6 @@ void setupPromoteJob(JobType jobType) {

AUTHOR_CREDS_ID: "${GIT_AUTHOR_CREDENTIALS_ID}",
GITHUB_TOKEN_CREDS_ID: "${GIT_AUTHOR_TOKEN_CREDENTIALS_ID}",
GIT_AUTHOR_BOT: "${GIT_BOT_AUTHOR_NAME}",
BOT_CREDENTIALS_ID: "${GIT_BOT_AUTHOR_CREDENTIALS_ID}",
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand Down
14 changes: 3 additions & 11 deletions .ci/jenkins/scripts/helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,8 @@ String getGitAuthorCredsID() {
return env.AUTHOR_CREDS_ID
}

String getBotBranch() {
return "${getProjectVersion()}-${env.BOT_BRANCH_HASH}"
}

String getBotAuthor() {
return env.GIT_AUTHOR_BOT
}

String getBotAuthorCredsID() {
return env.BOT_CREDENTIALS_ID
String getPRBranch() {
return "${getProjectVersion()}-${env.PR_BRANCH_HASH}"
}

String getProjectVersion() {
Expand All @@ -279,7 +271,7 @@ String getNextVersion() {
}

String getSnapshotBranch() {
return "${getNextVersion()}-${env.BOT_BRANCH_HASH}"
return "${getNextVersion()}-${env.PR_BRANCH_HASH}"
}

boolean shouldLaunchTests() {
Expand Down
Loading