WIP: sends message if the project is above the memory limit
Checks if the project has reached it's limit, blocks the push and messages the user
Merge request reports
Activity
Added 1 commit:
- 4e9b7dbc - sends message if the project is above the memory limit
32 34 rescue AccessDeniedError => ex 33 35 $stderr.puts "GitLab: #{ex.message}" 34 36 false 37 rescue MemoryLimitReachedError => ex 38 $stderr.puts "Gitlab: Project has reached the memory limit by: #{ex.message}MB please free some memory in Gitlab's UI to be able to push." Let's take what Yorick suggested:
This project exceeds the limit of XXX and as a result you are unable to push to this repository. Please contact your GitLab administrators for more information.
@axil can you help us with this message? It's linked to https://gitlab.com/gitlab-org/gitlab-ee/issues/559
32 34 rescue AccessDeniedError => ex 33 35 $stderr.puts "GitLab: #{ex.message}" 34 36 false 37 rescue MemoryLimitReachedError => ex 38 $stderr.puts "Gitlab: Project has reached the memory limit by: #{ex.message}MB please free some memory in Gitlab's UI to be able to push." @regisF regarding your comment in https://gitlab.com/gitlab-org/gitlab-shell/commit/4e9b7dbc7e42626ca4f4676ad91f17951f97af9a#note_14655690.
This project exceeds the limit of XXX and as a result you are unable to push to this repository. Please contact your GitLab administrators for more information.
First we would need to answer my question in https://gitlab.com/gitlab-org/gitlab-ee/issues/559#note_14666536.
Are we limiting the whole project's size? Like, do we also count its size in the DB (issues,MRs, etc.)? Do we count the wikis as well (they are Git repos after all)? If this is only about the
repo.git
size on disk, then the the feature should be renamed from "Project size limit" to "Repository size limit" to better reflect our terminology.
If like I suspect we are limiting just the repository size, the message should rather read:
GitLab: --- GitLab: This repository's size exceeds the limit of XX MB and as a result GitLab: you are unable to push to it. Please contact your GitLab GitLab: administrator for more information. GitLab: ---
Note that I added upper/lower dashes and limited the characters to 74 per line so that it reads better than https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/87#note_14651450. We might need to make this a default to all messages from gitlab-shell, but that's for another issue :)
Edited by Achilleas Pipinellis@axil Thanks for your input. Definitely a great improvement. I've replied to you in the issue, but the short answer is yes - we are only checking the repo size limit.
@regisF the reality is that the project is 99.36MB :) I make the difference in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6020/diffs
size_to_remove
method thought it would be more descriptiveOk then, two solutions:
This repository's size (99.36 MB) exceeds the limit of 10 MB and as a result...
This repository's size (99.36 MB) exceeds the limit of 10 MB by 89.36 MB and as a result...
Solution 2 might be better because it provides all the data we need to know without making mental calculations, especially if the limits are numbers that are non-round (ie a limit of 27.99 MB - good luck with figuring out the precise over limit number).
I prefer second option also. thanks for the input @regisF :)
I actually think they should be together since it is a measure. like
1m
and2L
they are always together @axil WDYT?
@tiagonbotelho you mention memory in various places, but I think it's size we're talking about here. Mentioning memory is kinda confusing :)
I will rename from
project
torepository
and frommemory
tosize
also thank you so much for the text and the layout @axilmentioned in issue #57
FYI, you may want to investigate the accuracy of
repository_size
: https://gitlab.com/gitlab-org/gitlab-ce/issues/19811@stanhu I can try to check it out after I made this feature work :) I also have one question because we are allowing a user to push a repository with alot of memory the first time is there any way of checking the size of the push before receiving/updating the repo? Right now we just check if what we have is above the limit and make it impossible for the user to push even more files until he fixes the issue
also have one question because we are allowing a user to push a repository with alot of memory the first time is there any way of checking the size of the push before receiving/updating the repo? Right now we just check if what we have is above the limit and make it impossible for the user to push even more files until he fixes the issue
@tiagonbotelho Just to be clear: when you say "memory", do you mean RAM or disk space? It's important to make that distinction.
If you are talking about RAM, you've actually touched upon a problem with git that @chriscool is fixing with git itself: https://public-inbox.org/git/20160824184157.19264-1-chriscool@tuxfamily.org/ (https://gitlab.com/gitlab-org/gitlab-ce/issues/17808#note_14458207)
If you are talking about disk space, you may have to consider if this can be done in the pre-receive or update hooks: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
Edited by Stan Hu@stanhu I was referring to Disk Space and thank you for the useful links :) because what we have right now just blocks based on the memory occupied in Gitlab and not on the local machine of the user when he's pushing.
A user that has a repository in Gitlab with 80GB and pushes to make it 10GB should be accepted IMO. And in the first push the user has 0MB inside Gitlab and can have 80GB in the local repo and he will be able to push
let's move this discussion to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6020 since I am being more active there.