2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class LfsCheck < BaseChecker
|
2019-12-04 20:38:33 +05:30
|
|
|
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".'
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
def validate!
|
2019-07-07 11:18:12 +05:30
|
|
|
return unless Feature.enabled?(:lfs_check, default_enabled: true)
|
2019-02-15 15:39:39 +05:30
|
|
|
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::UnauthorizedError, ERROR_MESSAGE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|