From c132ee4303082fa1e2a8b9628968a14e0c3f18cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 20 Sep 2023 15:53:35 +0200 Subject: [PATCH] ci: drop pushing commit tags for Docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nobody is using them and we are just cluttering up the repo. Signed-off-by: Jakub SokoĊ‚owski --- ci/Jenkinsfile.docker | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/ci/Jenkinsfile.docker b/ci/Jenkinsfile.docker index 2adfecd3..175b1bd4 100644 --- a/ci/Jenkinsfile.docker +++ b/ci/Jenkinsfile.docker @@ -37,12 +37,8 @@ pipeline { stages { stage('Build') { steps { script { - def imageTag = GIT_COMMIT.take(8) - if (env.JOB_BASE_NAME == 'release') { - imageTag = params.GIT_REF - } image = docker.build( - "${params.IMAGE_NAME}:${imageTag}", + "${params.IMAGE_NAME}:${params.IMAGE_TAG}", "--build-arg='GIT_COMMIT=${GIT_COMMIT.take(8)}' ." ) } } @@ -51,19 +47,13 @@ pipeline { stage('Push') { steps { script { withDockerRegistry([ - credentialsId: params.DOCKER_CRED, url: "" + credentialsId: params.DOCKER_CRED, url: '' ]) { image.push() - } - } } - } - - stage('Deploy') { - steps { script { - withDockerRegistry([ - credentialsId: params.DOCKER_CRED, url: "" - ]) { - image.push(env.IMAGE_TAG) + /* If Git ref is a tag push it as Docker tag too. */ + if (env.GIT_BRANCH ==~ /v\d+\.\d+\.\d+.*/) { + image.push(params.GIT_REF) + } } } } }