From bfcae4d04c0490f1ef7a7b6a225c093009f9b2aa Mon Sep 17 00:00:00 2001
From: Dominik Hebeler <dominik@suma-ev.de>
Date: Fri, 30 Sep 2022 12:02:34 +0200
Subject: [PATCH] using sed to trim dashes

---
 .gitlab/deployment_scripts/cleanup_tags_non_revision.sh | 2 +-
 .gitlab/deployment_scripts/cleanup_tags_revision.sh     | 2 +-
 .gitlab/deployment_scripts/delete_deployment.sh         | 2 +-
 .gitlab/deployment_scripts/update_deployment.sh         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab/deployment_scripts/cleanup_tags_non_revision.sh b/.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
index 85a9f400e..f4808372b 100755
--- a/.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
+++ b/.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
@@ -3,7 +3,7 @@
 set -e
 
 HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
-HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
+HELM_RELEASE_NAME=$(echo $HELM_RELEASE_NAME | sed 's/-$//')
 
 # Get All existing tags for the fpm repo
 echo "Fetching existing fpm tags..."
diff --git a/.gitlab/deployment_scripts/cleanup_tags_revision.sh b/.gitlab/deployment_scripts/cleanup_tags_revision.sh
index c16936e14..51cdc2712 100755
--- a/.gitlab/deployment_scripts/cleanup_tags_revision.sh
+++ b/.gitlab/deployment_scripts/cleanup_tags_revision.sh
@@ -3,7 +3,7 @@
 # Call script with KEEP_N variable set to specify the amount of releases to keep
 
 HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
-HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
+HELM_RELEASE_NAME=$(echo $HELM_RELEASE_NAME | sed 's/-$//')
 
 helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME}
 if [ $? -ne 0 ]
diff --git a/.gitlab/deployment_scripts/delete_deployment.sh b/.gitlab/deployment_scripts/delete_deployment.sh
index 50f4fdcab..7fd1544bf 100755
--- a/.gitlab/deployment_scripts/delete_deployment.sh
+++ b/.gitlab/deployment_scripts/delete_deployment.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
-HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
+HELM_RELEASE_NAME=$(echo $HELM_RELEASE_NAME | sed 's/-$//')
 
 echo "Removing Image Tags..."
 .gitlab/deployment_scripts/cleanup_tags_revision.sh
diff --git a/.gitlab/deployment_scripts/update_deployment.sh b/.gitlab/deployment_scripts/update_deployment.sh
index ed2e7ea0d..c49f097d2 100755
--- a/.gitlab/deployment_scripts/update_deployment.sh
+++ b/.gitlab/deployment_scripts/update_deployment.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
-HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
+HELM_RELEASE_NAME=$(echo $HELM_RELEASE_NAME | sed 's/-$//')
 
 helm -n $KUBE_NAMESPACE upgrade --install \
     ${HELM_RELEASE_NAME} \
-- 
GitLab