From e1ef3b41da243752340cd40cb57c6eb7ecc0c3b2 Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 25 Jan 2024 15:27:02 +0100
Subject: [PATCH] OZG-4792 fixed the buildtag refernece in Jenkinsfile and
 removed DoubleTagTest

---
 Jenkinsfile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index ea618206..622a5868 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -12,6 +12,7 @@ pipeline {
         SH_SUCCESS_STATUS_CODE = 0
         IMAGE_TAG = generateImageTag()
         HELM_CHART_VERSION = generateHelmChartVersion()
+        BUILD_TAG = generateBuildTag()
     }
 
     options {
@@ -73,12 +74,11 @@ pipeline {
             steps {
                 script {
                     FAILED_STAGE=env.STAGE_NAME
-                    env.BUILD_TAG = generateBuildTag()
                 }
                 
                 configFileProvider([configFile(fileId: 'maven-settings', variable: 'MAVEN_SETTINGS')]) {
                     withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
-                        sh 'mvn -s $MAVEN_SETTINGS spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dimagetag=$IMAGE_TAG -Dbuildtag=${env.BUILD_TAG} -Dspring-boot.build-image.publish=true -Duser=${USER} -Dpassword=${PASSWORD}'
+                        sh 'mvn -s $MAVEN_SETTINGS spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -Dimagetag=$IMAGE_TAG -Dbuildtag=$BUILD_TAG -Dspring-boot.build-image.publish=true -Duser=${USER} -Dpassword=${PASSWORD}'
                     }
                 }
             }
@@ -161,14 +161,12 @@ String generateImageTag() {
 String generateBuildTag() {
 
     def buildName = "docker.ozg-sh.de/administration"
-    def buildTag = buildName+":"+IMAGE_TAG
+    def buildTag = buildName+":"+generateImageTag()
 
     if (isMasterBranch()) {
         buildTag += ","+buildName+":snapshot-latest"
     } else if (isReleaseBranch()) {
         buildTag += ","+buildName+":latest"
-    } else if (env.BRANCH_NAME == 'OZG-4792-FixMasterBranchTagging') {
-        buildTag += ","+buildName+":doubleTagTest"
     }
     return buildTag
 }
-- 
GitLab