Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-03 15:13:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-03 15:13:11 +0300
commit2c01907a1ab4b328e2f20ddf9e10dfe6dc17105a (patch)
tree5c9aec88c17b1046dd7e47657c39f3f8f36bf0f1 /scripts
parent29761d24b86b7a091ca83df4e8cd1cc14f81d534 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/review-apps.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 79571cb1e53..54924fb8a34 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -128,8 +128,22 @@ function disable_sign_ups() {
true
fi
- # Create the root token + Disable sign-ups
- local disable_signup_rb="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; Gitlab::CurrentSettings.current_application_settings.update!(signup_enabled: false)"
+# Create the root token + Disable sign-ups
+#
+# We use this weird syntax because we need to pass a one-liner ruby command to a Kubernetes container via kubectl.
+read -r -d '' multiline_ruby_code <<RUBY
+user = User.find_by_username('root');
+puts 'Error: Could not find root user. Check that the database was properly seeded'; exit(1) unless user;
+token = user.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;
+Gitlab::CurrentSettings.current_application_settings.update!(signup_enabled: false);
+RUBY
+
+ local disable_signup_rb=$(echo $multiline_ruby_code | tr '\n' ' ')
if (retry_exponential "run_task \"${disable_signup_rb}\""); then
echoinfo "Sign-ups have been disabled successfully."
else