Stop Package when namespace over_storage_limit
What does this MR do and why?
Closes https://gitlab.com/gitlab-org/gitlab/-/issues/348728
When namespace storage limit is breached package creation needs to be restricted, so as to avoid more breach of storage-limit. This MR just prevents package_creation when namespace storage is breached
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Validate "pushing a package artifact" when over_storage_limit?
is false
- Created a test project on my local server, (no storage breached yet)
- Created an personal auth token for api
- Try to upload a generic package using curl to validate "pushing a package artifact" is working fine
➜ gitlab git:(issue_348728_locking_package_registry) ✗ curl --header "PRIVATE-TOKEN:-R--yUNzYSixMsUxZRJW" \
--upload-file /Users/surajtripathi/test.txt \
"http://127.0.0.1:3000/api/v4/projects/20/packages/generic/my_package/0.0.1/test.txt" | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 45 100 25 100 20 34 27 --:--:-- --:--:-- --:--:-- 61
{
"message": "201 Created"
}
Validate "pushing a package artifact" when over_storage_limit?
is true
- Modify over_storage_limit? locally(for testing purposes), to return
true
- Try to upload a generic package using curl to validate "pushing a package artifact" is blocked
➜ gitlab git:(issue_348728_locking_package_registry) ✗ curl --header "PRIVATE-TOKEN:-R--yUNzYSixMsUxZRJW" \
--upload-file /Users/surajtripathi/test.txt \
"http://127.0.0.1:3000/api/v4/projects/20/packages/generic/my_package/0.0.1/test.txt" | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 47 100 27 100 20 7 5 0:00:04 0:00:03 0:00:01 13
{
"message": "403 Forbidden"
}
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 Suraj Tripathi