Commit 871a23c1 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'caalberts-retry-review-apps-token' into 'master'

Ensure review app sign up is disabled

Closes #258962

See merge request gitlab-org/gitlab!43810
parents 568940df e488337c
......@@ -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"'
......
......@@ -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"')
......
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