Skip to content

Commit

Permalink
Fix weekly image tags (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigonull committed Aug 26, 2024
1 parent d50c2df commit d7ab4ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.build-image
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pipeline {
int retries = Integer.parseInt(env.MAX_REGISTRY_RETRIES)
String imageTag = getBuiltImageTag()
if (isDeployLatestTag()) {
latestTag = getTriggeringProjectName().contains('weekly') ? 'weekly-latest' : 'latest'
latestTag = 'latest'
cloud.skopeoCopyRegistryImages(imageTag, getBuiltImageTag(latestTag), retries)
}
}
Expand Down
18 changes: 5 additions & 13 deletions .ci/jenkins/Jenkinsfile.weekly.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pipeline {
stage('Create and push a new tag') {
steps {
script {
projectVersion = getProjectVersion(false)
projectVersion = getProjectVersion()
dir(getRepoName()) {
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
githubscm.tagRepository(projectVersion)
Expand Down Expand Up @@ -212,7 +212,7 @@ void createBuildAndTestStageClosure(String image) {
buildParams.add(string(name: 'DEPLOY_IMAGE_NAMESPACE', value: getDeployImageNamespace()))
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(booleanParam(name: 'DEPLOY_WITH_LATEST_TAG', value: false))

def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false)
if (job.result != 'SUCCESS') {
Expand Down Expand Up @@ -281,11 +281,7 @@ String getDeployImageNameSuffix() {
return params.IMAGE_NAME_SUFFIX
}
String getDeployImageTag() {
return getProjectVersion(false)
}

boolean isDeployLatestTag() {
return params.DEPLOY_WITH_LATEST_TAG
return getProjectVersion()
}

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -346,10 +342,6 @@ String getProjectVersionDate() {
return projectVersionDate.replace('-', '')
}

String getProjectVersion(boolean keepSnapshotSuffix = true) {
def projectVersion = env.PROJECT_VERSION
if (keepSnapshotSuffix) {
return projectVersion.replace("-SNAPSHOT", "-${getProjectVersionDate()}-SNAPSHOT")
}
return projectVersion.replace("-SNAPSHOT", "-${getProjectVersionDate()}")
String getProjectVersion() {
return env.PROJECT_VERSION + '-' + getProjectVersionDate()
}

0 comments on commit d7ab4ae

Please sign in to comment.