Skip to content

Commit

Permalink
kie-issues#1397 - Adjust git tag creation for Apache 10 release (#1790)
Browse files Browse the repository at this point in the history
* Adjust git tag creation for Apache 10 release

* Add image suffix to the images artifact
  • Loading branch information
rodrigonull authored Jul 29, 2024
1 parent ad28882 commit bc09044
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.build-image
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pipeline {
}
steps {
script {
def resultingFileName = "incubator-kie-${getImageArtifactReleaseVersion()}-${getBuildImageName()}.tar.gz"
def resultingFileName = "incubator-kie-${getImageArtifactReleaseVersion()}-${getBuildImageName()}-image.tar.gz"
def signatureFileName = "${resultingFileName}.asc"
sh """
docker pull ${getBuiltImageTag()}
Expand Down
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

0 comments on commit bc09044

Please sign in to comment.