From e488337ce99efd8ca1c2d313f2e1bf682902979a Mon Sep 17 00:00:00 2001
From: Albert Salim <asalim@gitlab.com>
Date: Mon, 5 Oct 2020 09:49:32 +0000
Subject: [PATCH] Ensure review app sign up is disabled

---
 .gitlab/ci/review.gitlab-ci.yml    | 2 +-
 scripts/review_apps/review-apps.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml
index fab33dd3c07d1..0fd2c01bb0454 100644
--- a/.gitlab/ci/review.gitlab-ci.yml
+++ b/.gitlab/ci/review.gitlab-ci.yml
@@ -72,7 +72,7 @@ review-deploy:
     - download_chart
     - date
     - deploy || (display_deployment_debug && exit 1)
-    - disable_sign_ups
+    - disable_sign_ups || (delete_release && exit 1)
     # When the job is manual, review-qa-smoke is also manual and we don't want people
     # to have to manually start the jobs in sequence, so we do it for them.
     - '[ -z $CI_JOB_MANUAL ] || play_job "review-qa-smoke"'
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 1a1cfbbd5f6a0..b8cbe625e5b6f 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -137,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() {
@@ -150,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"')
-- 
GitLab