Skip to content

Amend out-of-storage banner text

Sheldon Led requested to merge led/327193-out-of-storage-banner-text into master

What does this MR do and why?

Relates to: #327193 (closed)

Adds a link to the docs on the out-of-storage banner text

Link: https://docs.gitlab.com/ee/user/usage_quotas.html

Screenshots or screen recordings

Alert 1: message starting with "Please purchase additional storage..."

Before After
out-of-storage-banner_alert-type1_before out-of-storage-banner_alert-type1_after

Alert 2: message starting with "You have consumed all of your additional storage..."

Before After
out-of-storage-banner_alert-type2_before out-of-storage-banner_alert-type2_after

Alert 3: message starting with "If you reach 100% storage capacity..."

Before After
out-of-storage-banner_alert-type3_before out-of-storage-banner_alert-type3_after

Alert 4: message starting with "my_group is now read-only..."

Before After
out-of-storage-banner_alert-type4_before out-of-storage-banner_alert-type4_after

How to set up and validate locally

I found 4 variations of this alert that are relevant to this change.

It was a bit tricky to set the data in order to show these alerts. Working backwards in the code execution I was able to find what I need to alter in order to show them. These were the steps I took:

  1. rails c
  2. Feature.disable(:namespace_storage_limit)
  3. Gitlab::CurrentSettings.update!(automatic_purchased_storage_allocation: true)
  4. Gitlab::CurrentSettings.update!(repository_size_limit: 10)
  5. gdk restart
  6. Have a group you own, go to the Group's page: http://127.0.0.1:3000/my_group

This was the baseline for all the other alerts. After this setup you should be able to see the first alert variation: "Please purchase additional storage..."

To see the second alert variation, starting with "You have consumed all of your additional storage...", do these extra steps

  1. On the Group's page, copy the Group ID, in my case 385
  2. Go to a project page: http://127.0.0.1:3000/my_group/my_project
  3. Copy the Project ID, in my case 32
  4. n = Group.find(385)
  5. p = Project.find(32)
  6. Add some storage data at Group level
    n.root_storage_statistics&.destroy!
    s = Namespace::RootStorageStatistics.new(
      namespace: n,
      build_artifacts_size: 400000,
      wiki_size: 300000,
      repository_size: 3900000,
      packages_size: 3800000,
      lfs_objects_size: 4800000
    )
    s.storage_size = s.repository_size + s.lfs_objects_size + s.wiki_size + s.build_artifacts_size + s.packages_size
    s.save!
  7. Add some storage data at Project level
    p.statistics.update(
      repository_size: 3900000000,
      lfs_objects_size: 4800000000,
      build_artifacts_size: 400000000,
      wiki_size: 300000000,
      packages_size: 3800000000
    )
  8. n.update(additional_purchased_storage_size: 15)
  9. gdk restart
  10. Go to the Group's page: http://127.0.0.1:3000/my_group

Now the alert message body should start with "You have consumed all of your additional storage..."

The third alert variation will show if you enable the Feature Flag and do these extra steps:

  1. Feature.enable(:namespace_storage_limit)
  2. n.update(additional_purchased_storage_size: 15000)
  3. Add more storage data at Group Level
    n.root_storage_statistics&.destroy!
    s = Namespace::RootStorageStatistics.new(
      namespace: n,
      build_artifacts_size: 400000000,
      wiki_size: 300000000,
      repository_size: 3900000000,
      packages_size: 3800000000,
      lfs_objects_size: 4800000000
    )
    s.storage_size = s.repository_size + s.lfs_objects_size + s.wiki_size + s.build_artifacts_size + s.packages_size
    s.save!

Now the alert message body should start with "If you reach 100% storage capacity..."

To see the fourth alert variation we need to exceed storage size limit:

  1. n.update(additional_purchased_storage_size: 12000)
  2. gdk restart
  3. If you have a license on your local setup, you might need to bypass it by adding a return true after line 41 in root_storage_size.rb

Now you should see a message starting with "my_group is now read-only...."

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

Loading