diff options
Diffstat (limited to 'lib/gitlab/checks/global_file_size_check.rb')
-rw-r--r-- | lib/gitlab/checks/global_file_size_check.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/gitlab/checks/global_file_size_check.rb b/lib/gitlab/checks/global_file_size_check.rb new file mode 100644 index 00000000000..418d2d32b57 --- /dev/null +++ b/lib/gitlab/checks/global_file_size_check.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Gitlab + module Checks + class GlobalFileSizeCheck < BaseBulkChecker + MAX_FILE_SIZE_MB = 100 + LOG_MESSAGE = 'Checking for blobs over the file size limit' + + def validate! + return unless Feature.enabled?(:global_file_size_check, project) + + Gitlab::AppJsonLogger.info(LOG_MESSAGE) + logger.log_timed(LOG_MESSAGE) do + Gitlab::Checks::FileSizeCheck::AllowExistingOversizedBlobs.new( + project: project, + changes: changes, + file_size_limit_megabytes: MAX_FILE_SIZE_MB + ).find + + # TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/393535 + # - set limit per plan tier + # - raise an error if large blobs are found + end + + true + end + end + end +end |