Skip to content

Commit

Permalink
Add git tag name and image artifact release version paramters
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigonull committed May 27, 2024
1 parent a9bbdeb commit 7c74d31
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .ci/jenkins/Jenkinsfile.build-image
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ pipeline {
}
steps {
script {
def resultingFileName = "incubator-kie-${getReleaseVersion()}-${getBuildImageName()}.tar.gz"
def resultingFileName = "incubator-kie-${getImageArtifactReleaseVersion()}-${getBuildImageName()}.tar.gz"
def signatureFileName = "${resultingFileName}.asc"
sh """
docker pull ${getBuiltImageTag()}
docker save ${getBuiltImageTag()} | gzip > ${resultingFileName}
"""
release.gpgImportKeyFromFileWithPassword(getReleaseGpgSignKeyCredsId(), getReleaseGpgSignPassphraseCredsId())
release.gpgSignFileDetachedSignatureWithPassword(resultingFileName, signatureFileName, getReleaseGpgSignPassphraseCredsId())
release.svnUploadFileToRepository(getReleaseSvnRepository(), getReleaseSvnCredsId(), getReleaseVersion(), resultingFileName, signatureFileName)
release.svnUploadFileToRepository(getReleaseSvnRepository(), getReleaseSvnCredsId(), getImageArtifactReleaseVersion(), resultingFileName, signatureFileName)
}
}
post {
Expand Down Expand Up @@ -457,6 +457,6 @@ String getReleaseSvnCredsId() {
return env.RELEASE_SVN_CREDS_ID
}

String getReleaseVersion() {
return env.RELEASE_VERSION
String getImageArtifactReleaseVersion() {
return env.IMAGE_ARTIFACT_RELEASE_VERSION
}
14 changes: 9 additions & 5 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ pipeline {
String prLink = githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorPushCredsId())
deployProperties["${getRepoName()}.pr.link"] = prLink


// Create a new tag
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.tagRepository(getProjectVersion())
githubscm.pushRemoteTag('origin', getProjectVersion(), getGitAuthorPushCredsId())
githubscm.tagRepository(getGitTagName())
githubscm.pushRemoteTag('origin', getGitTagName(), getGitAuthorPushCredsId())
}
}
}
Expand All @@ -229,6 +228,7 @@ pipeline {
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", geGitTagName())
}
}
}
Expand Down Expand Up @@ -315,7 +315,7 @@ void createBuildAndTestStageClosure(String image) {
buildParams.add(string(name: 'DEPLOY_IMAGE_NAME_SUFFIX', value: getDeployImageNameSuffix()))
buildParams.add(string(name: 'DEPLOY_IMAGE_TAG', value: getDeployImageTag()))
buildParams.add(booleanParam(name: 'DEPLOY_WITH_LATEST_TAG', value: isDeployLatestTag()))
buildParams.add(string(name: 'RELEASE_VERSION', value: getProjectVersion()))
buildParams.add(string(name: 'IMAGE_ARTIFACT_RELEASE_VERSION', value: getGitTagName()))

def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false)
if (job.result != 'SUCCESS') {
Expand Down Expand Up @@ -458,4 +458,8 @@ String[] getImages() {

String getQuarkusPlatformVersion() {
return params.QUARKUS_PLATFORM_VERSION
}
}

String getGitTagName() {
return params.GIT_TAG_NAME
}
3 changes: 2 additions & 1 deletion .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ void setupDeployJob(JobType jobType) {
stringParam('KOGITO_ARTIFACTS_VERSION', '', 'Optional. If artifacts\' version is different from PROJECT_VERSION.')
if (jobType == JobType.RELEASE) {
stringParam('QUARKUS_PLATFORM_VERSION', '', 'Allow to override the Quarkus Platform version')
stringParam('GIT_TAG_NAME', '', 'Git tag to be created')
}

stringParam('KOGITO_PR_BRANCH', '', 'PR branch name')
Expand Down Expand Up @@ -210,7 +211,7 @@ void setupBuildImageJob(JobType jobType) {
stringParam('DEPLOY_IMAGE_TAG', '', 'Image tag to use to deploy images')
booleanParam('DEPLOY_WITH_LATEST_TAG', false, 'Set to true if you want the deployed images to also be with the `latest` tag')
booleanParam('EXPORT_AND_GPG_SIGN_IMAGE', jobType == JobType.RELEASE, 'Set to true if should images be exported and signed.')
stringParam('RELEASE_VERSION', '', 'Set the release version to be attached to the images artifacts names')
stringParam('IMAGE_ARTIFACT_RELEASE_VERSION', '', 'Set the release version to be attached to the images artifacts names')
}
}
}
Expand Down

0 comments on commit 7c74d31

Please sign in to comment.