Welcome to mirror list, hosted at ThFree Co, Russian Federation.

global_file_size_check.rb « checks « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 418d2d32b57fe7d178ec80c6334246ef5beccd41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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