echoerr "In order to protect Review Apps, REVIEW_APPS_ROOT_TOKEN variable must be set"
false
else
true
fi
# 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}"
# Disable sign-ups
curl --request PUT --header"PRIVATE-TOKEN: ${REVIEW_APPS_ROOT_TOKEN}""${CI_ENVIRONMENT_URL}/api/v4/application/settings?signup_enabled=false"
local signup_enabled=$(curl --silent--show-error--request GET --header"PRIVATE-TOKEN: ${REVIEW_APPS_ROOT_TOKEN}""${CI_ENVIRONMENT_URL}/api/v4/application/settings" | jq ".signup_enabled")
if[["${signup_enabled}"=="false"]];then
echoinfo "Sign-ups have been disabled successfully."
else
echoerr "Sign-ups should be disabled but are still enabled!"
false
fi
}
function check_kube_domain(){
echoinfo "Checking that Kube domain exists..."true