Preview free user cap only for specific namespaces
What does this MR do and why?
Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/365673
This adds the field include_for_free_user_cap_preview
to
namespace_settings
to only show the preview of free user cap when
- The Feature flag is enabled (
preview_free_user_cap
) - The namespace has
include_for_free_user_cap_preview
set totrue
This enables us to rollout the preview per namespace, which would not be possible (performant enough) if we would use Feature Flag subjects.
Migration
Migrate
bin/rails db:migrate:main
main: == 20220712094945 AddIncludeForFreeUserCapPreviewToNamespaceSettings: migrating
main: -- add_column(:namespace_settings, :include_for_free_user_cap_preview, :boolean, {:null=>false, :default=>false})
main: -> 0.0044s
main: == 20220712094945 AddIncludeForFreeUserCapPreviewToNamespaceSettings: migrated (0.0055s)
Rollback
bin/rails db:rollback:main
main: == 20220712094945 AddIncludeForFreeUserCapPreviewToNamespaceSettings: reverting
main: -- remove_column(:namespace_settings, :include_for_free_user_cap_preview)
main: -> 0.0010s
main: == 20220712094945 AddIncludeForFreeUserCapPreviewToNamespaceSettings: reverted (0.0015s)
Screenshots or screen recordings
These screenshots are just here to know where the preview_free_user_cap
has an impact on:
No cap, no Preview | Preview active | Cap enabled |
---|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
export GITLAB_SIMULATE_SAAS=1
gdk start
- Enable preview_free_user_cap as feature flag globally + use namespace-plans, and pick a group to test it on
bin/rails c Feature.enable(:preview_free_user_cap) ApplicationSetting.first.update(check_namespace_plan: true) # find a group ID group = Group.find(GROUP_ID) group.namespace_settings.update_columns(include_for_free_user_cap_preview: true)
- Go to the Usage Quota Page (Group > Settings > Usage Quota) http://localhost:3000/groups/GROUP_NAME/-/usage_quotas#seats-quota-tab and be able to see the toggles and the banner
- If you want to check the
free_user_cap
bin/rails c Feature.disable(:preview_free_user_cap) Feature.enable(:free_user_cap)
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.
Edited by Nicolas Dular