Skip to content

Trigger shared runner credit card validation alert on click, make it always dismissable

What does this MR do and why?

For #339949 (closed)

This MR changes the flow of the alert that blocks a user from enabling shared runners for a project if they haven't done credit card validation: it makes the toggle visible from the start, then shows the same dismissable alert each time enabling the toggle fails for that reason.

This change is behind the <code data-sourcepos="7:29-7:63">ci_require_credit_card_on_free_plan</code> feature flag, so it doesn't require changelog/documentation.

Screenshots or screen recordings

scenario before with this MR
try to enable shared runners without credit card validation toggle is initially hidden by dismissable alert, then clicking the toggle triggers a non-dismissable alert Screen_Recording_2022-01-31_at_14.13.32 toggle is initially shown, same dismissable alert is triggered each time toggle is clicked Screen_Recording_2022-01-31_at_12.47.03

How to set up and validate locally

  1. git checkout 339949-action-based-dismissable-credit-card-validation-alert
  2. echo "Feature.enable(:ci_require_credit_card_on_free_plan)" | rails c
  3. in ee/app/models/ee/user.rb, make requires_credit_card? return true for testing purposes:
    def requires_credit_card?(project)
      true
    end
  1. navigate to Settings => CI/CD for a project and expand the Runners section
  2. click the Enable shared runners for this project toggle - the alert should appear
  3. dismiss the alert and try again - the same alert should appear each time

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miranda Fluharty

Merge request reports