From 6c7376fa79dbe5e87f9497dc883dd6aa8d710e71 Mon Sep 17 00:00:00 2001
From: Martin <git@mail.de>
Date: Fri, 22 Nov 2024 10:42:30 +0100
Subject: [PATCH] OZG-7121 adjust Service port name

---
 Jenkinsfile                          | 19 +++++++++++--------
 src/main/helm/templates/service.yaml |  2 +-
 src/test/helm/service_test.yaml      |  2 +-
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 0da508c..8619cb3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -256,19 +256,21 @@ String getElementAccessToken() {
 
 Void deployHelmChart(String helmChartVersion) {       
     withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
-        if (env.BRANCH_NAME == 'release') {
-            result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps -F file=@xta-test-server-'''+helmChartVersion+'''.tgz''', returnStdout: true
-        }
-        else {
-            result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@xta-test-server-'''+helmChartVersion+'''.tgz''', returnStdout: true
-        }
-
+        result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=''' + getHelmChartRepository() + ''' -F file=@xta-test-server-'''+helmChartVersion+'''.tgz''', returnStdout: true
         if (result != '') {
             error(result)
         }
     }
 }
 
+String getHelmChartRepository(){
+	if (env.BRANCH_NAME == 'release') {
+        return 'ozg-base-apps'
+    }
+    return 'ozg-base-apps-snapshot'
+    }
+}
+
 Void loginToDockerRepo() {
     withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
         sh 'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}'
@@ -286,11 +288,12 @@ String buildVersionName() {
 
 Void tagAndPushDockerImage(String newTag){
     withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
+         sh "chmod +x script/push-docker-image.sh"
 		 sh """
             export DOCKER_USER=${USER}
             export DOCKER_PASSWORD=${PASSWORD}
             export BRANCH_NAME=${env.BRANCH_NAME}
-            ./tag_and_push_docker_image.sh ${newTag} ${getPomVersion()}
+            ./script/push-docker-image.sh ${newTag} ${getPomVersion()}
         """
     }
 }
diff --git a/src/main/helm/templates/service.yaml b/src/main/helm/templates/service.yaml
index 71ee6f4..cc2a471 100644
--- a/src/main/helm/templates/service.yaml
+++ b/src/main/helm/templates/service.yaml
@@ -35,7 +35,7 @@ spec:
     - name: 8080tcp1
       port: 8080
       protocol: TCP
-    - name: 8080tcp1
+    - name: 8443tcp1
       port: 8443
       protocol: TCP
     - name: metrics
diff --git a/src/test/helm/service_test.yaml b/src/test/helm/service_test.yaml
index ff1b3b4..585ea72 100644
--- a/src/test/helm/service_test.yaml
+++ b/src/test/helm/service_test.yaml
@@ -55,7 +55,7 @@ tests:
       - contains:
           path: spec.ports
           content:
-            name: 8080tcp1
+            name: 8443tcp1
             port: 8443
             protocol: TCP
      
-- 
GitLab