Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#1397 - Adjust git tag creation for Apache 10 release #1790

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
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
89 changes: 5 additions & 84 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

deployProperties = [:]

changesDone = false

BUILT_IMAGES = Collections.synchronizedList([])
BUILD_FAILED_IMAGES = Collections.synchronizedList([])
TEST_FAILED_IMAGES = Collections.synchronizedList([])
Expand Down Expand Up @@ -73,22 +71,6 @@ pipeline {
}
}

stage('Prepare for PR') {
when {
expression { return isRelease() }
}
steps {
script {
dir(getRepoName()) {
if (githubscm.isBranchExist('origin', getPRBranch())) {
githubscm.removeRemoteBranch('origin', getPRBranch(), getGitAuthorPushCredsId())
}
githubscm.createBranch(getPRBranch())
}
}
}
}

stage('Setup Quarkus platform version') {
when {
expression { isRelease() }
Expand Down Expand Up @@ -124,7 +106,7 @@ pipeline {
}
sh versionCmd

commitAndPushChanges("Update project version to ${getProjectVersion()}")
commitAndTagChanges("[${getBuildBranch()}] Update version to ${getProjectVersion()}")
}
}
}
Expand Down Expand Up @@ -172,67 +154,6 @@ pipeline {
}
}
}

stage('Create PR') {
when {
expression {
return changesDone && isRelease()
}
}
steps {
script {
dir(getRepoName()) {
def commitMsg = "[${getBuildBranch()}] Update Maven artifacts"
def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}."
if (isRelease()) {
commitMsg = "[${getBuildBranch()}] Update project version to ${getProjectVersion()}"
prBody += '\nPlease do not merge, it should be merged automatically.'
} else if (currentBuild.currentResult != 'SUCCESS') {
commitMsg += " (${currentBuild.currentResult})"
prBody += '\n\nSuccessful images:\n'
getBuiltImages().each {
prBody += "- ${it}\n"
}
if (getBuildFailedImages()) {
prBody += '\nBuild failures on those images:\n'
getBuildFailedImages().each {
prBody += "- ${it}\n"
}
} else {
prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n'
}
if (getTestFailedImages()) {
prBody += '\nTest failures on those images:\n'
getTestFailedImages().each {
prBody += "- ${it}\n"
}
} else {
prBody += '\nImages were all successfully built but some other problem occured in the pipeline execution...\n'
}
prBody += '\nSee build url above for more information'
}
String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorPushCredsId())
deployProperties["${getRepoName()}.pr.link"] = prLink

// Create a new tag
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.tagRepository(getGitTagName())
githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId())
}
}
}
post {
always {
script {
setDeployPropertyIfNeeded("${getRepoName()}.pr.source.uri", "https://github.com/${getGitAuthor()}/${getRepoName()}")
setDeployPropertyIfNeeded("${getRepoName()}.pr.source.ref", getPRBranch())
setDeployPropertyIfNeeded("${getRepoName()}.pr.target.uri", "https://github.com/${getGitAuthor()}/${getRepoName()}")
setDeployPropertyIfNeeded("${getRepoName()}.pr.target.ref", getBuildBranch())
setDeployPropertyIfNeeded("${getRepoName()}.tag.name", getGitTagName())
}
}
}
}
stage('Finalize') {
steps {
script {
Expand Down Expand Up @@ -283,11 +204,11 @@ void checkoutRepo() {
checkout(githubscm.resolveRepository(getRepoName(), getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId()))
}

void commitAndPushChanges(String commitMsg) {
void commitAndTagChanges(String commitMsg) {
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.commitChanges(commitMsg)
githubscm.pushObject('origin', getPRBranch(), getGitAuthorPushCredsId())
changesDone = true
githubscm.tagRepository(getGitTagName())
githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId())
}

void createBuildAndTestStageClosure(String image) {
Expand Down Expand Up @@ -363,7 +284,7 @@ List getTestFailedImages() {
////////////////////////////////////////////////////////////////////////

boolean isDeployImage() {
return !Boolean.valueOf(env.DISABLE_IMAGES_DEPLOY)
return !env.DISABLE_IMAGES_DEPLOY
}

boolean isDeployImageInOpenshiftRegistry() {
Expand Down
Loading