Class: Gitlab::Checks::LfsCheck

Inherits:
BaseChecker show all
Defined in:
lib/gitlab/checks/lfs_check.rb

Constant Summary collapse

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".'

Instance Attribute Summary

Attributes inherited from BaseChecker

#change_access

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

This class inherits a constructor from Gitlab::Checks::BaseChecker

Instance Method Details

#validate!Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/checks/lfs_check.rb', line 9

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

  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