2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
namespace :file_hooks do
|
2020-04-22 19:07:51 +05:30
|
|
|
desc 'Validate existing file hooks'
|
2018-03-27 19:54:05 +05:30
|
|
|
task validate: :environment do
|
2021-09-04 01:27:46 +05:30
|
|
|
puts 'Validating file hooks from /file_hooks directories'
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
Gitlab::FileHook.files.each do |file|
|
|
|
|
success, message = Gitlab::FileHook.execute(file, Gitlab::DataBuilder::Push::SAMPLE_DATA)
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
if success
|
|
|
|
puts "* #{file} succeed (zero exit code)."
|
|
|
|
else
|
|
|
|
puts "* #{file} failure (non-zero exit code). #{message}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|