Skip to content

Update the combined banner when exceeding both storage and user limits

Sheldon Led requested to merge led/416794-swap-button-order into master

What does this MR do and why?

This implements https://gitlab.com/gitlab-org/gitlab/-/issues/416794 where we make some updates to the banner for namespaces over user and storage limits:

  • Swap the buttons
  • Adjust the copy
  • Amend the FAQ link

Screenshots or screen recordings

Group Owners

Before After
126075_owner_beforer 126075_owner_after

non-Owners members

Minor addition of the word Free in the first phrase.

Before After
126075_non-owner_beforer 126075_non-owner_after

How to set up and validate locally

Setting this up is a bit cumbersome given the dozens of possible states. Here's a list of steps:

  1. Make sure these FFs are disabled: Feature.disable(:free_user_cap) and Feature.disable(:free_user_cap_new_namespaces)
  2. Make sure free user cap dashboard is disabled: ::Gitlab::CurrentSettings.update(dashboard_limit_enabled: false)
  3. Make sure this other setting is disabled: ::Gitlab::CurrentSettings.update(dashboard_limit_new_namespace_creation_enforcement_date: nil)
  4. Make sure FF for storage check is disabled: Feature.disable(:free_user_cap_without_storage_check)
  5. Create a new group, take note of its ID, e.g.: 88
  6. Add 6+ members to that group
  7. Enable Free user cap notification FF: Feature.enable(:preview_free_user_cap)
  8. Set UserCap Dashboard limit: ::Gitlab::CurrentSettings.update(dashboard_limit_enabled: true, dashboard_limit: 5)
    1. You should see a banner saying something about Your top-level group will move to a read-only state soon, a.k.a the UserCap pre-enforcement banner
    Screenshot 126075_user_cap_preenforcement_alert
  9. Now with your Group (g = Group.find(88) where 88 is your group ID from step 2)
    1. Set Storage Dashboard limit: g.actual_plan.actual_limits.update(storage_size_limit: 5 * 1024) This means 5 GB
    2. Set pre-enforcement notification limit, like 6 GB: g.actual_limits.update(notification_limit: 6 * 1024)
      1. Important: notification_limit should be higher than storage_size_limit. There's no validation in the backend though, discussion: !124075 (comment 1439722242)
    3. Set used storage over the notification limit: g.root_storage_statistics.update(storage_size: 7.gigabytes)
      1. If you get an error, try creating the record like so Namespace::RootStorageStatistics.new(namespace: g, storage_size: 7.gigabytes).save!
  10. Make sure pre-enforcement FF is enabled: Feature.enable(:namespace_storage_limit_show_preenforcement_banner)
  11. Turn on automatic purchased storage allocation: ::Gitlab::CurrentSettings.update(automatic_purchased_storage_allocation: true)
  12. Clear the cache: rails cache:clear
  13. You should now see a banner saying something about A namespace storage limit will soon be enforced for the namespace, a.k.a the Storage pre-enforcement banner
    Screenshot 126075_storage_preenforcement_alert
  14. Now enabling the combined banner is possible:
    1. Via free_user_cap by simply enabling Feature.enable(:free_user_cap), or...
    2. Via free_user_cap_new_namespaces:
      1. Feature.disable(:free_user_cap)
      2. Feature.enable(:free_user_cap_new_namespaces)
      3. Gitlab::CurrentSettings.update(dashboard_limit_new_namespace_creation_enforcement_date: g.created_at - 1.day)
    Screenshot 126075_combined_preenforcement_alert

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 Sheldon Led

Merge request reports