Projects: add export size limit
Issue
Currently, GitLab does not provide a way to limit a project export based on the full size of the project. Such a setting exists on the other hand for project imports, but not for exports. From time to time, our Sidekiq nodes report an alert on disk space because some user tried to export a project that is too big to fit into the filesystem of the host.
Having this setting would allow us to sync it up to the available storage size of the Sidekiq nodes, and at the same time inform our users and block directly from the UI/API attempts to export a project too big.
What does this MR do and why?
This MR adds the max_export_size
application setting that can be defined via UI (Admin Area) or API (Application settings API) - similar to the max_import_size
application setting. The default value is 0 (unlimited)
. If max_export_size
is set and the storage size of a project exceeds this limit, it can not be exported via UI or API. Instead, an error message is shown/returned.
/cc @bufferoverflow
Screenshots
Export size limit exceeded | Export size limit not exceeded |
---|---|
How to set up and validate locally
- Navigate to the settings of an existing project with over 1MB storage size: http://localhost:3000/twitter/Typeahead.Js/edit
- Try to export the project (
Advanced > Export project
)
➡ Project export started. A download link will be sent by email and made available on this page
✅ - Navigate to
Admin Area > General > Account and limit
: http://localhost:3000/admin/application_settings/general#js-account-settings - Set Maximum export size (MB) to
1
. - Navigate to the settings of an existing project with over 1MB storage size: http://localhost:3000/twitter/Typeahead.Js/edit
- Try to export the project (
Advanced > Export project
)
➡ The project size exceeds the export limit
🔴
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.