Commit 9beecef1 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed wrong release name

parent 52c08ba7
......@@ -12,6 +12,7 @@ workflow:
DOCKER_COMPOSER_IMAGE_TAG: $CI_COMMIT_REF_SLUG-composer-$CI_COMMIT_SHA
DOCKER_FPM_IMAGE_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA
DOCKER_NGINX_IMAGE_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHA
HELM_RELEASE_NAME: review-$CI_COMMIT_REF_SLUG
APP_ENV: development
APP_URL: "https://${CI_COMMIT_REF_SLUG}.review.metager.de"
- if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "development"
......@@ -19,6 +20,7 @@ workflow:
DOCKER_COMPOSER_IMAGE_TAG: $CI_COMMIT_BRANCH-composer-$CI_COMMIT_SHA
DOCKER_FPM_IMAGE_TAG: $CI_COMMIT_BRANCH-$CI_COMMIT_SHA
DOCKER_NGINX_IMAGE_TAG: $CI_COMMIT_BRANCH-$CI_COMMIT_SHA
HELM_RELEASE_NAME: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_BRANCH == "master"
variables:
APP_URL: https://metager.de
......
......@@ -5,10 +5,7 @@
FPM_REPOSITORY_ID=418
NGINX_REPOSITORY_ID=416
echo $KUBE_NAMESPACE
echo $CI_COMMIT_REF_SLUG
helm -n $KUBE_NAMESPACE history ${CI_COMMIT_REF_SLUG}
helm -n $KUBE_NAMESPACE history $HELM_RELEASE_NAME
if [ $? -ne 0 ]
then
echo "Release does not exist yet. Nothing to cleanup!"
......@@ -17,16 +14,16 @@ fi
set -e
revision_count=$(helm -n $KUBE_NAMESPACE history $CI_COMMIT_REF_SLUG -o json | jq -r '. | length')
revision_count=$(helm -n $KUBE_NAMESPACE history $HELM_RELEASE_NAME -o json | jq -r '. | length')
# Get the latest used image tags to make sure they are not deleted
latest_revision_values=$(helm -n $KUBE_NAMESPACE get values $CI_COMMIT_REF_SLUG -o json)
latest_revision_values=$(helm -n $KUBE_NAMESPACE get values $HELM_RELEASE_NAME -o json)
latest_fpm_tag=$(echo $latest_revision_values | jq -r '.image.fpm.tag')
latest_nginx_tag=$(echo $latest_revision_values | jq -r '.image.fpm.tag')
# 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 $CI_COMMIT_REF_SLUG -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
......@@ -34,7 +31,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 $CI_COMMIT_REF_SLUG --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 -n $KUBE_NAMESPACE upgrade --install \
review-${CI_COMMIT_REF_SLUG} \
$HELM_RELEASE_NAME \
chart/ \
-f $DEPLOYMENT_HELM_VALUES \
--set environment=$APP_ENV \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment