debian-mirror-gitlab/lib/tasks/gitlab/git.rake

26 lines
672 B
Ruby
Raw Normal View History

2015-12-23 02:04:40 +05:30
namespace :gitlab do
namespace :git do
2018-03-17 18:26:18 +05:30
desc 'GitLab | Git | Check all repos integrity'
task fsck: :gitlab_environment do
2015-12-23 02:04:40 +05:30
failures = []
2018-11-18 11:00:15 +05:30
Project.find_each(batch_size: 100) do |project|
begin
project.repository.fsck
rescue => e
failures << "#{project.full_path} on #{project.repository_storage}: #{e}"
2015-12-23 02:04:40 +05:30
end
2018-03-17 18:26:18 +05:30
2018-11-18 11:00:15 +05:30
puts "Performed integrity check for #{project.repository.full_path}"
2015-12-23 02:04:40 +05:30
end
2018-11-18 11:00:15 +05:30
if failures.empty?
puts "Done".color(:green)
2018-03-17 18:26:18 +05:30
else
2018-11-18 11:00:15 +05:30
puts "The following repositories reported errors:".color(:red)
failures.each { |f| puts "- #{f}" }
2018-03-17 18:26:18 +05:30
end
end
2015-12-23 02:04:40 +05:30
end
end