Disable sign up for review apps in one kubernetes roundtrip
What does this MR do and why?
In review apps, to disable sign-ups, we need to do two actions in the rails console:
- Create a PAT for the root user
- Disable sign-ups
Each time, we run a kubectl command that will boot up the GitLab rails console, which takes a bit more than 1 minute:
'disable_sign_ups' succeeded in 179 seconds.
'kubectl exec --namespace "review-375459-rev-kx4qgb" "review-375459-rev-kx4qgb-toolbox-55f5b944bb-8nc6k" -- gitlab-rails runner "token = User.find_by_username('root').personal_access_tokens.create(scopes: [:api], name: 'Token to disable sign-ups'); token.set_token('[MASKED]'); begin; token.save!; rescue(ActiveRecord::RecordNotUnique); end"' succeeded in 99 seconds.
'kubectl exec --namespace "review-375459-rev-kx4qgb" "review-375459-rev-kx4qgb-toolbox-55f5b944bb-8nc6k" -- gitlab-rails runner "Gitlab::CurrentSettings.current_application_settings.update!(signup_enabled: false)"' succeeded in 78 seconds.
This MR ensures that we do both aforementioned actions with one kubectl command and one boot of the GitLab rails console.
This should save at least a minute at each review-deploy jobs
Performance improvements
The average of review-deploy
job is around 10 minutes. In this pipeline, we're at 7min41sec
It's most likely not an actual 2min30sec improvement on average, but I hope it should be around a minute
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #375459 (closed)