From 330d9e024b814fc133c00f8f74b1e1b2e3c47e15 Mon Sep 17 00:00:00 2001 From: Rodrigo Antunes Date: Mon, 27 May 2024 14:30:38 -0300 Subject: [PATCH] Update CI pipelines for the Apache 10 release --- .ci/jenkins/Jenkinsfile.build-image | 25 +++++++------------------ .ci/jenkins/Jenkinsfile.deploy | 1 + .ci/jenkins/Jenkinsfile.promote | 18 ------------------ .ci/jenkins/dsl/jobs.groovy | 1 + 4 files changed, 9 insertions(+), 36 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image index 2d5845416..2d24558b1 100644 --- a/.ci/jenkins/Jenkinsfile.build-image +++ b/.ci/jenkins/Jenkinsfile.build-image @@ -16,11 +16,9 @@ */ @Library('jenkins-pipeline-shared-libraries')_ -QUAY_REGISTRY = 'quay.io' - pipeline { agent { - docker { + docker { image env.AGENT_DOCKER_BUILDER_IMAGE args env.AGENT_DOCKER_BUILDER_ARGS label util.avoidFaultyNodes() @@ -149,18 +147,6 @@ pipeline { } steps { script { - // Make public if quay registry - if (getDeployImageRegistry() == QUAY_REGISTRY) { - String namespace = getDeployImageNamespace() - String repository = getFinalImageName() - echo "Check and set public if needed Quay repository ${namespace}/${repository}" - try { - cloud.makeQuayImagePublic(namespace, repository, [ usernamePassword: getDeployImageRegistryCredentials()]) - } catch (err) { - echo "[ERROR] Cannot set image quay.io/${namespace}/${repository} as visible" - } - } - int retries = Integer.parseInt(env.MAX_REGISTRY_RETRIES) String imageTag = getBuiltImageTag() if (isDeployLatestTag()) { @@ -228,7 +214,7 @@ pipeline { } steps { script { - def resultingFileName = "${getFinalImageName()}.tar.gz" + def resultingFileName = "incubator-kie-${getReleaseVersion()}-${getBuildImageName()}.tar.gz" def signatureFileName = "${resultingFileName}.asc" sh """ docker pull ${getBuiltImageTag()} @@ -328,9 +314,8 @@ String getDeployImageNameSuffix() { String getDeployImageTag() { if (params.DEPLOY_IMAGE_TAG != '') { return params.DEPLOY_IMAGE_TAG - } else { - return sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() } + return sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() } String getFinalImageName() { @@ -471,3 +456,7 @@ String getReleaseSvnRepository() { String getReleaseSvnCredsId() { return env.RELEASE_SVN_CREDS_ID } + +String getReleaseVersion() { + return env.RELEASE_VERSION +} diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 8ee24f812..5f9a17bbe 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -308,6 +308,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())) def job = build(job: 'kogito-images.build-image', wait: true, parameters: buildParams, propagate: false) if (job.result != 'SUCCESS') { diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index c3b2164b3..2b7cbbd6c 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -173,20 +173,6 @@ void promoteImage(String oldImageName, String newImageName) { cloud.skopeoCopyRegistryImages(oldImageName, newImageName, Integer.parseInt(env.MAX_REGISTRY_RETRIES)) } -// Set images public on quay. Useful when new images are introduced. -void makeQuayNewImagesPublic() { - String namespace = getNewImageNamespace() - for (String imageName : getImages()) { - String repository = getFinalImageName(imageName, getNewImageNameSuffix()) - echo "Check and set public if needed Quay repository ${namespace}/${repository}" - try { - cloud.makeQuayImagePublic(namespace, repository, [ usernamePassword: getNewImageRegistryCredentials()]) - } catch (err) { - echo "[ERROR] Cannot set image quay.io/${namespace}/${repository} as visible" - } - } -} - String getOldImageFullTag(String imageName) { return "${getOldImageRegistry()}/${getOldImageNamespace()}/${getFinalImageName(imageName, getOldImageNameSuffix())}:${getOldImageTag()}" } @@ -296,10 +282,6 @@ String getGitAuthorPushCredsId() { return env.GIT_AUTHOR_PUSH_CREDS_ID } -boolean isQuayRegistry(String registry) { - return registry == 'quay.io' -} - //////////////////////////////////////////////////////////////////////// // Old image information //////////////////////////////////////////////////////////////////////// diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 9f997b07e..ebaf81ee6 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -210,6 +210,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') } } }