Skip to content

[RUN-AS-IF-FOSS] Add validate account modal from CI/CD shared runners page

Stan Hu requested to merge sh-validate-account-modal into master

Previously once a user disabled shared runners, the only way to get this modal to display would be to create a new project with a .gitlab-ci.yml, let the pipeline fail, visit the pipeline, and then find this same modal.

If credit card validation is required to enable shared runners for a given project, this change will now display the Validate account button and direct the user to the validation.

Relates to #334322 (closed)

Screenshots

New validation text:

image

Existing validation text on Run pipeline view:

image

Testing

To fake GitLab.com, I did this hack:

diff --git a/ee/app/models/ee/user.rb b/ee/app/models/ee/user.rb
index 7a9edda1ba2d..0096b8be4d18 100644
--- a/ee/app/models/ee/user.rb
+++ b/ee/app/models/ee/user.rb
@@ -433,6 +433,8 @@ def has_valid_credit_card?
     end
 
     def requires_credit_card_to_run_pipelines?(project)
+      return true
+
       return false unless project.shared_runners_enabled
 
       requires_credit_card?(project)
@@ -443,6 +445,8 @@ def requires_credit_card_to_enable_shared_runners?(project)
     end
 
     def requires_credit_card?(project)
+      return true
+
       return false unless ::Gitlab.com?
       return false unless created_after_credit_card_release_day?(project)
Edited by Stan Hu

Merge request reports