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

22 lines
700 B
Ruby
Raw Normal View History

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
2020-04-22 19:07:51 +05:30
puts 'Validating file hooks from /file_hooks and /plugins directories'
2018-03-27 19:54:05 +05:30
2020-03-13 15:44:24 +05:30
Gitlab::FileHook.files.each do |file|
2020-05-24 23:13:21 +05:30
if File.dirname(file).ends_with?('plugins')
puts 'DEPRECATED: /plugins directory is deprecated and will be removed in 14.0. ' \
'Please move your files into /file_hooks directory.'
end
2020-03-13 15:44:24 +05:30
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