diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /scripts/review_apps | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'scripts/review_apps')
-rwxr-xr-x | scripts/review_apps/review-apps.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh index 862c3b4bb62..b8cbe625e5b 100755 --- a/scripts/review_apps/review-apps.sh +++ b/scripts/review_apps/review-apps.sh @@ -48,7 +48,13 @@ function delete_release() { return fi - helm_delete_release "${namespace}" "${release}" + # Check if helm release exists before attempting to delete + # There may be situation where k8s resources exist, but helm release does not, + # for example, following a failed helm install. + # In such cases, we still want to continue to clean up k8s resources. + if deploy_exists "${namespace}" "${release}"; then + helm_delete_release "${namespace}" "${release}" + fi kubectl_cleanup_release "${namespace}" "${release}" } @@ -131,7 +137,7 @@ function run_task() { local ruby_cmd="${1}" local task_runner_pod=$(get_pod "task-runner") - kubectl exec -it --namespace "${namespace}" "${task_runner_pod}" -- gitlab-rails runner "${ruby_cmd}" + kubectl exec --namespace "${namespace}" "${task_runner_pod}" -- gitlab-rails runner "${ruby_cmd}" } function disable_sign_ups() { @@ -144,7 +150,7 @@ function disable_sign_ups() { # Create the root token local ruby_cmd="token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'Token to disable sign-ups'); token.set_token('${REVIEW_APPS_ROOT_TOKEN}'); begin; token.save!; rescue(ActiveRecord::RecordNotUnique); end" - run_task "${ruby_cmd}" + retry "run_task \"${ruby_cmd}\"" # Disable sign-ups local signup_enabled=$(retry 'curl --silent --show-error --request PUT --header "PRIVATE-TOKEN: ${REVIEW_APPS_ROOT_TOKEN}" "${CI_ENVIRONMENT_URL}/api/v4/application/settings?signup_enabled=false" | jq ".signup_enabled"') |