Project export: The project size exceeds the export limit while not exceeding it
Summary
A customer is doing a project export and is getting the error The project size exceeds the export limit
.
The project size with artifacts is 4.3GiB, while without the artifacts the project is only 3.5MB
The max export size is set to 1GiB.
Steps to reproduce
Create a project with a large artifact and set the max export lower than the artifact size.
What is the current bug behavior?
The calculation includes :build_artifacts_size
and :packages_size
.
What is the expected correct behavior?
That the calculation for the export would exclude :build_artifacts_size
and :packages_size
.
Possible fixes
The calculation is done here:
if self.statistics.storage_size > Gitlab::CurrentSettings.current_application_settings.max_export_size.megabytes
raise ExportLimitExceeded, _('The project size exceeds the export limit.')
end
Source: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/project.rb#L3396-3398
This points to ProjectStatistics.storage_siz
e where storage_size
is calculated by self.storage_size = storage_size_components.sum { |component| method(component).call }
. storage_size_components
is equal to STORAGE_SIZE_COMPONENTS
and that is
STORAGE_SIZE_COMPONENTS = [
:repository_size,
:wiki_size,
:lfs_objects_size,
:build_artifacts_size,
:packages_size,
:snippets_size,
:pipeline_artifacts_size,
:uploads_size
].freeze
This includes :build_artifacts_size
and :packages_size
While they are mentioned in the export as The following items will NOT be exported