Commit 2381e62b authored by Patricio Cano's avatar Patricio Cano

Added CHANGELOG item, documentation, some corrections, and a frontend helper for the size limits.

parent a841d79d
......@@ -4,6 +4,7 @@ v 8.12.0 (Unreleased)
- [ES] Instrument Elasticsearch::Git::Repository
- Request only the LDAP attributes we need
- Add 'Sync now' to group members page !704
- Add repository size limits and enforce them !740
- [ES] Instrument other Gitlab::Elastic classes
- [ES] Fix: Elasticsearch does not find partial matches in project names
- [ES] Global code search
......
......@@ -331,6 +331,7 @@ class ProjectsController < Projects::ApplicationController
:mirror,
:mirror_user_id,
:mirror_trigger_builds,
:repository_size_limit,
:reset_approvals_on_push
)
end
......
......@@ -231,8 +231,12 @@ module ProjectsHelper
end
def repository_size(project = @project)
size_in_bytes = project.repository_size * 1.megabyte
number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)
size_in_bytes = project.aggregated_repository_size * 1.megabyte
limit_in_bytes = project.repo_size_limit * 1.megabyte
limit_text = limit_in_bytes.zero? ? 'Unlimited' : number_to_human_size(limit_in_bytes, delimiter: ',', precision: 2)
"#{number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)}/#{limit_text}"
end
def default_url_to_repo(project = @project)
......
......@@ -68,6 +68,7 @@
- [High Availability](administration/high_availability/README.md) Configure multiple servers for scaling or high availability.
- [Container Registry](administration/container_registry.md) Configure Docker Registry with GitLab.
- [Multiple mountpoints for the repositories storage](administration/repository_storages.md) Define multiple repository storage paths to distribute the storage load.
- [Repository restrictions](administration/repository_restrictions.md) Define size restrictions for your repositories to limit the space they occupy in your storage device. Includes LFS objects.
## Contributor documentation
......
# Repository size restrictions
> **Note:** Introduced with 8.12 EE
Repositories within your GitLab instance can grow quickly, specially if you are
using LFS. Their size can grow exponentially and eat up your storage device quite
quickly.
In order to avoid this from happening, you can set a hard limit for your repositories.
You can set this limit globally, per group, or per project, with per project limits
taking the highest priority.
These settings can be found within each project, or group settings and within
the Application Settings for the global value.
Setting the limit to `0` means there is no restrictions.
# Restrictions
When a project has reached its size limit, you will not be able to push to it,
create new merge request, or merge existing ones. You will still be able to create
new issues, and clone the project.
Uploading LFS objects will also be denied.
In order to lift this restrictions, the administrator of the GitLab instance
needs to increase the limit on the particular project that exceeded it.
# Limitations
The first push of a new project cannot be checked for size as of now, so the first
push will allow you to upload more than the limit dictates, but every subsequent
push will be denied.
LFS objects, however, can be checked on first push and **will** be rejected if the
sum of their sizes exceeds the maximum allowed repository size.
\ No newline at end of file
......@@ -163,14 +163,14 @@ module Gitlab
[
"This repository's size (#{project.aggregated_repository_size}MB) exceeds the limit of #{project.repo_size_limit}MB",
"GitLab: by #{project.size_to_remove}MB and as a result you are unable to push to it.",
"GitLab: Please contact your Gitlab administrator for more information.",
"GitLab: Please contact your GitLab administrator for more information.",
].join("\n") + "\n"
end
def will_go_over_limit_message
[
"Your push to this repository would cause it to exceed the limit of #{project.repo_size_limit}MB.",
"GitLab: As a result it has been rejected. Please contact your Gitlab administrator for more information.",
"GitLab: As a result it has been rejected. Please contact your GitLab administrator for more information.",
].join("\n") + "\n"
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment