Skip to content

Update Namespace.actual_repository_size_limit

What does this MR do and why?

In this MR we're introducing plan_limits.repository_size as part of Namespace.actual_repository_size_limit so that we can achieve our main goal in https://gitlab.com/groups/gitlab-org/-/epics/14212

The hierarchy is as follows: projects.repository_size_limit > namespaces.repository_size_limit > plan_limits.repository_size > application_settings.repository_size_limit

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Instance level repository_size_limit

Ultimate Group Free Group
instance_repository_size_limit_ultimate instance_repository_size_limit_free

Plan level repository_size_limit

Here, the Ultimate plan has a 500GiB repository_size_limit limit

Ultimate Group Free Group
plan_repository_size_limit_ultimate instance_repository_size_limit_free

Group level repository_size_limit

Here we only show the Free plan group where before they'd have the 10GiB instance limit and after we had overridden the instance limit with a bigger one, only for their group

Free Group before Free Group after
instance_repository_size_limit_free group_repository_size_limit_free

How to set up and validate locally

For this change we'll test repository_size_limit in 3 levels: Instance, Plan, Group:

  • For all levels you'll need to:
    1. Simulate SaaS GitLab.com and have at least one group with the Ultimate Plan (watch the video for visual instructions)
    2. Enable this setting in rails console: Gitlab::CurrentSettings.update!(automatic_purchased_storage_allocation: true)
    3. Make note of your Group with Ultimate plan and have another Free plan group for comparison
  1. Instance: This one is how it works for most groups in GitLab.com
    1. Gitlab::CurrentSettings.update!(repository_size_limit: 10.gigabytes)
    2. Now go to your Group Usage Quotas Page, choose the storage tab: https://gdk.test:3443/groups/<your-group>/-/usage_quotas#storage-quota-tab
    3. Make sure sure you see the 10GiB limit in the UI, like in the screenshots
    4. Alternatively you can check in rails console: Group.find(<group-id>).actual_repository_size_limit
  2. Plan: This is the new logic being added in this MR
    1. Plan.find_by_name('ultimate').actual_limits.update!(repository_size: 500.gigabytes)
    2. Feature.enable(:plan_limits_repository_size)
    3. rails cache:clear
    4. Now go to Usage Quotas Page and compare both groups and what limit they have
    5. Alternatively you can check in rails console: Group.find(<group-id>).actual_repository_size_limit
  3. Group: This is also currently in production, we're only asserting no regression here, like in the instance case
    1. Group.find(<group-id>).update(repository_size_limit: 25.gigabytes)
    2. rails cache:clear
    3. Now go to Usage Quotas Page and compare both groups and what limit they have
    4. Alternatively you can check in rails console: Group.find(<group-id>).actual_repository_size_limit
Edited by Sheldon Led

Merge request reports

Loading