2015-09-22 08:04:14 -04:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :git do
|
2017-12-14 05:49:35 -05:00
|
|
|
desc 'GitLab | Git | Check all repos integrity'
|
2018-01-24 03:12:33 -05:00
|
|
|
task fsck: :gitlab_environment do
|
2015-09-22 08:04:14 -04:00
|
|
|
failures = []
|
2018-07-24 06:17:29 -04:00
|
|
|
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
|
|
|
|
2018-07-24 06:17:29 -04:00
|
|
|
puts "Performed integrity check for #{project.repository.full_path}"
|
2015-09-22 08:04:14 -04:00
|
|
|
end
|
|
|
|
|
2018-07-24 06:17:29 -04:00
|
|
|
if failures.empty?
|
|
|
|
puts "Done".color(:green)
|
2018-01-03 08:51:04 -05:00
|
|
|
else
|
2018-07-24 06:17:29 -04:00
|
|
|
puts "The following repositories reported errors:".color(:red)
|
|
|
|
failures.each { |f| puts "- #{f}" }
|
2018-01-03 08:51:04 -05:00
|
|
|
end
|
|
|
|
end
|
2015-09-22 08:04:14 -04:00
|
|
|
end
|
|
|
|
end
|