From 00f039dbaad8445d0f538e580448cfcbcdbad867 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 10 Jan 2024 11:27:47 +0100 Subject: [PATCH] CI: Use tag as release version, fix delete --- .gitlab-ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ddb6d21e..5344a675 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -113,7 +113,14 @@ generate-version: before_script: - apk add -q git script: - - VERSION="$(git describe --abbrev=0 --tags)-${CI_COMMIT_REF_NAME}+${CI_PIPELINE_ID}.${CI_COMMIT_SHORT_SHA}" + - > + VERSION="$(\ + git describe --exact-match --tags HEAD 2> /dev/null\ + || (\ + (git describe --abbrev=0 --tags | tr -d '\n')\ + && echo "-${CI_COMMIT_REF_NAME}+${CI_PIPELINE_ID}.${CI_COMMIT_SHORT_SHA}"\ + )\ + )" - echo "${VERSION}" - echo -n "${VERSION}" > storage/app/VERSION @@ -441,7 +448,8 @@ deploy: GIT_STRATEGY: none when: manual script: - - kubectl delete all,ingress,pvc -l app=$CI_PROJECT_PATH_SLUG -l environment=$CI_ENVIRONMENT_SLUG + - TARGETS=all,ingress,pvc,certificate + - kubectl -n "${KUBE_NAMESPACE}" delete $TARGETS -l app=$CI_PROJECT_PATH_SLUG -l environment=$CI_ENVIRONMENT_SLUG deploy-k8s-review: <<: *deploy_k8s