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

lfs_check.rb « checks « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38f0b82c8b4d127a0c69ff021d9d490186ed4492 (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
# frozen_string_literal: true

module Gitlab
  module Checks
    class LfsCheck < BaseChecker
      LOG_MESSAGE = 'Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...'
      ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'

      def validate!
        # This feature flag is used for disabling integrify check on some envs
        # because these costy calculations may cause performance issues
        return unless Feature.enabled?(:lfs_check, default_enabled: true)

        return unless project.lfs_enabled?
        return if skip_lfs_integrity_check
        return if deletion?

        logger.log_timed(LOG_MESSAGE) do
          lfs_check = Checks::LfsIntegrity.new(project, newrev, logger.time_left)

          if lfs_check.objects_missing?
            raise GitAccess::ForbiddenError, ERROR_MESSAGE
          end
        end
      end
    end
  end
end