Use CliNotification in PostReceiveService
What does this MR do and why?
This is the second MR to close https://gitlab.com/gitlab-org/gitlab/-/issues/360326
This MR is using the newly introduced CliNotification
class in !108327 (merged)
How to set up and validate locally
- Make sure the
automatic_purchased_storage_allocation
andenforce_namespace_storage_limit
application settings are both enabled (true
).
gitlabhq_development=# SELECT automatic_purchased_storage_allocation, enforce_namespace_storage_limit FROM application_settings;
automatic_purchased_storage_allocation | enforce_namespace_storage_limit
----------------------------------------+---------------------------------
t | t
(1 row)
gitlabhq_development=#
- Enable the following feature flags in a rails console.
[1] pry(main)> Feature.enable(:namespace_storage_limit)
[...]
[2] pry(main)> Feature.enable(:enforce_storage_limit_for_paid)
[...]
[3] pry(main)> Feature.enable(:enforce_storage_limit_for_free)
[...]
[4] pry(main)> Feature.enable(:namespace_storage_limit_bypass_date_check)
Testing updated messages locally
- Pick any project in your local GitLab instance,
- Clone the project.
- In the example here, my project is "Wget2" under the "Gnuwget" Group
- We should override
def current_size
anddef limit
inee/app/models/namespaces/storage/root_size.rb
warning
message:
To test the Apply the following changes to your local GitLab instance in ee/app/models/namespaces/storage/root_size.rb
.
For warning messages:
def current_size
7680000
end
def limit
8000000
end
$ git checkout -b my-test-branch
$ echo 'change file' > README.md
$ git add .
$ git commit -m "Pushing warning"
$ git push
This should give you the following warning message:
error
message:
To test the Apply the following changes to your local GitLab instance in ee/app/models/namespaces/storage/root_size.rb
.
def current_size
8000000
end
def limit
7680000
end
$ git checkout -b my-test-branch
$ echo 'change file' > README.md
$ git add .
$ git commit -m "Pushing errors"
$ git push
This should give you the following error message:
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.