gitlab-org--gitlab-foss/lib/tasks/gitlab/git.rake

26 lines
672 B
Ruby
Raw Normal View History

namespace :gitlab do
namespace :git do
2017-12-14 05:49:35 -05:00
desc 'GitLab | Git | Check all repos integrity'
task fsck: :gitlab_environment do
failures = []
Project.find_each(batch_size: 100) do |project|
begin
project.repository.fsck
rescue => e
failures << "#{project.full_path} on #{project.repository_storage}: #{e}"
2015-10-01 07:34:41 -04:00
end
2018-01-03 08:51:04 -05:00
puts "Performed integrity check for #{project.repository.full_path}"
end
if failures.empty?
puts "Done".color(:green)
2018-01-03 08:51:04 -05:00
else
puts "The following repositories reported errors:".color(:red)
failures.each { |f| puts "- #{f}" }
2018-01-03 08:51:04 -05:00
end
end
end
end