Skip to content

Fix bug with repo limit push error

Vijay Hawoldar requested to merge vij-fix-cli-repo-message into master

What does this MR do and why?

When a repository limit has been breached in a namespace, we currently render a push error message when pushing to a different project that incorrectly states the push was rejected.

As can be seen in #416646 (closed), this is not the case - the push is successful, and we should actually render a warning about locked projects instead.

This MR addresses the problem by creating a new error message class specifically for project repository limit errors, so we can display a more relevant error message rather than falling back (incorrectly) to the push error rejection message.

Actual push rejections are not handled in the PostReceiveService so we don't need to handle that - they're taken care of in Gitlab::GitAccess and RepositorySizeErrorMessage classes.


We have a number of scenarios where we receive messages from GitLab when pushing, in particular:

Scenario Message displayed Triggered from Screenshot
Push to a project that is over the limit

un-touched by this MR
RepositorySizeErrorMessage#push_error GitAccess Screenshot_2023-07-18_at_15.09.20
Push to a project when another project in then namespace is over the limit

this was the one that was broken and has been fixed by this MR (!125408 (comment 1468585416))
RootExcessSizeErrorMessage#push_error PostReceiveService Screenshot_2023-07-18_at_15.08.38
Push to any project in a namespace that has additional storage and has nearly consumed all the additional storage

Copy has been tweaked in this MR (!125408 (comment 1468585409))
RootExcessSizeErrorMessage#push_warning PostReceiveService Screenshot_2023-07-18_at_15.04.18

Refs: #416646 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image Screenshot_2023-07-18_at_13.37.22

How to set up and validate locally

  1. Create a group
  2. Create a project in that group and add some files to it, lets call it Project A
  3. Create another project, lets say Project B
  4. Set a repository limit you can easily go over, ::Gitlab::CurrentSettings.update(repository_size_limit: 10) # 10 bytes

At this point, Project A should be locked/over the limit, but Project B is empty.

Push some changes to Project B.

Before this MR, you'd see the message in the screenshot above, after this MR there should be an appropriate message informing the user about other locked projects 🤞🏽

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 Vijay Hawoldar

Merge request reports