Skip to content
Snippets Groups Projects
Commit e5d5c503 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed secret name

parent cfcf5226
No related branches found
No related tags found
1 merge request!1979Resolve "Implement Prometheus export for fpm status"
......@@ -2,6 +2,9 @@
set -e
HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
# Get All existing tags for the fpm repo
echo "Fetching existing fpm tags..."
declare -A existing_tags_fpm
......@@ -105,10 +108,10 @@ echo ""
echo "Fetching Tags from helm revision history to not be deleted..."
declare -A revision_tags_fpm
declare -A revision_tags_nginx
helm_release_revisions=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME:0:53} -o json | jq -r '.[]["revision"]')
helm_release_revisions=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME} -o json | jq -r '.[]["revision"]')
for revision in $helm_release_revisions
do
revision_values=$(helm -n $KUBE_NAMESPACE get values ${HELM_RELEASE_NAME:0:53} --revision=$revision -o json | jq -r '.')
revision_values=$(helm -n $KUBE_NAMESPACE get values ${HELM_RELEASE_NAME} --revision=$revision -o json | jq -r '.')
revision_tags_fpm[$(echo $revision_values | jq -r '.image.fpm.tag')]=1
revision_tags_nginx[$(echo $revision_values | jq -r '.image.nginx.tag')]=1
done
......
......@@ -2,7 +2,10 @@
# Call script with KEEP_N variable set to specify the amount of releases to keep
helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME:0:53}
HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME}
if [ $? -ne 0 ]
then
echo "Release does not exist yet. Nothing to cleanup!"
......@@ -11,11 +14,11 @@ fi
set -e
revision_count=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME:0:53} -o json | jq -r '. | length')
revision_count=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME} -o json | jq -r '. | length')
# Get List of revisions to expire (delete the image tags)
end_index=$(($KEEP_N > $revision_count ? 0 : $revision_count-$KEEP_N))
expired_revisions=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME:0:53} -o json | jq -r ".[0:$end_index][][\"revision\"]")
expired_revisions=$(helm -n $KUBE_NAMESPACE history ${HELM_RELEASE_NAME} -o json | jq -r ".[0:$end_index][][\"revision\"]")
# Loop through those revisions
declare -A expired_fpm_tags
......@@ -23,7 +26,7 @@ declare -A expired_nginx_tags
for revision in $expired_revisions
do
# Get Values for this revision
revision_values=$(helm -n $KUBE_NAMESPACE get values ${HELM_RELEASE_NAME:0:53} --revision=$revision -ojson)
revision_values=$(helm -n $KUBE_NAMESPACE get values ${HELM_RELEASE_NAME} --revision=$revision -ojson)
# Get Image Tags for this revision
revision_fpm_tag=$(echo $revision_values | jq -r '.image.fpm.tag')
revision_nginx_tag=$(echo $revision_values | jq -r '.image.nginx.tag')
......
#!/bin/bash
HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
helm -n $KUBE_NAMESPACE upgrade --install \
${HELM_RELEASE_NAME:0:53} \
${HELM_RELEASE_NAME} \
chart/ \
-f $DEPLOYMENT_HELM_VALUES \
--set environment=$APP_ENV \
......
......@@ -2,8 +2,11 @@
set -e
HELM_RELEASE_NAME=${HELM_RELEASE_NAME:0:53}
HELM_RELEASE_NAME=${HELM_RELEASE_NAME%%*(-)}
# Create/Update the secret
kubectl -n $KUBE_NAMESPACE create secret generic $CI_COMMIT_REF_SLUG \
kubectl -n $KUBE_NAMESPACE create secret generic ${HELM_RELEASE_NAME} \
--from-file=${ENV_PRODUCTION} \
--from-file=${SUMAS} \
--from-file=${SUMASEN} \
......
......@@ -74,5 +74,5 @@ Create the name of the service account to use
{{- end -}}
{{- define "secret_name" -}}
{{- printf "%s" .Release.Name | replace "review-" " " | trim }}
{{- printf "%s" .Release.Name }}
{{- end -}}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment