Skip to content
Snippets Groups Projects
Commit d7061cef authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge branch 'add-review-app-cleanup' into 'master'

Add review-cleanup-failed-deployment to prepare

See merge request gitlab-org/gitlab-ce!32839
parents 946af3b6 5a1659d8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -134,6 +134,15 @@ review-stop:
artifacts:
paths: []
 
review-cleanup-failed-deployment:
extends: review-stop
stage: prepare
when: on_success
needs: []
allow_failure: false
script:
- delete_failed_release
.review-qa-base:
extends:
- .review-docker
Loading
Loading
Loading
Loading
@@ -49,6 +49,26 @@ function delete_release() {
helm delete --purge "$name"
}
 
function delete_failed_release() {
if [ -z "$CI_ENVIRONMENT_SLUG" ]; then
echoerr "No release given, aborting the delete!"
return
fi
if ! deploy_exists "${KUBE_NAMESPACE}" "${CI_ENVIRONMENT_SLUG}"; then
echoinfo "No Review App with ${CI_ENVIRONMENT_SLUG} is currently deployed."
else
# Cleanup and previous installs, as FAILED and PENDING_UPGRADE will cause errors with `upgrade`
if previous_deploy_failed "$CI_ENVIRONMENT_SLUG" ; then
echoinfo "Review App deployment in bad state, cleaning up $CI_ENVIRONMENT_SLUG"
delete_release
else
echoinfo "Review App deployment in good state"
fi
fi
}
function get_pod() {
local app_name="${1}"
local status="${2-Running}"
Loading
Loading
@@ -193,7 +213,6 @@ function deploy() {
 
HELM_CMD=$(cat << EOF
helm upgrade --install \
--force \
--wait \
--timeout 900 \
--set releaseOverride="$CI_ENVIRONMENT_SLUG" \
Loading
Loading
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