2021-02-05 07:09:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-01-16 10:08:41 -05:00
|
|
|
namespace :file_hooks do
|
2020-04-21 11:21:10 -04:00
|
|
|
desc 'Validate existing file hooks'
|
2018-02-19 12:20:53 -05:00
|
|
|
task validate: :environment do
|
2021-05-19 14:10:39 -04:00
|
|
|
puts 'Validating file hooks from /file_hooks directories'
|
2018-02-19 12:20:53 -05:00
|
|
|
|
2020-01-16 10:08:41 -05:00
|
|
|
Gitlab::FileHook.files.each do |file|
|
|
|
|
success, message = Gitlab::FileHook.execute(file, Gitlab::DataBuilder::Push::SAMPLE_DATA)
|
2018-02-19 12:55:54 -05:00
|
|
|
|
2018-02-28 05:16:23 -05:00
|
|
|
if success
|
|
|
|
puts "* #{file} succeed (zero exit code)."
|
2018-02-19 12:20:53 -05:00
|
|
|
else
|
2018-02-28 05:16:23 -05:00
|
|
|
puts "* #{file} failure (non-zero exit code). #{message}"
|
2018-02-19 12:20:53 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-02-08 11:14:10 -05:00
|
|
|
end
|