summaryrefslogtreecommitdiff
path: root/lib/tasks/file_hooks.rake
blob: f767d63fe0d8a9741fec1a8ae9da5c60c2e49e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
namespace :file_hooks do
  desc 'Validate existing file hooks'
  task validate: :environment do
    puts 'Validating file hooks from /file_hooks and /plugins directories'

    Gitlab::FileHook.files.each do |file|
      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

      success, message = Gitlab::FileHook.execute(file, Gitlab::DataBuilder::Push::SAMPLE_DATA)

      if success
        puts "* #{file} succeed (zero exit code)."
      else
        puts "* #{file} failure (non-zero exit code). #{message}"
      end
    end
  end
end