Commit 61e83d6f authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'dz-deprecate-plugins-dir' into 'master'

Deprecate /plugins directory

See merge request gitlab-org/gitlab!29678
parents d6d3f703 a2c02c7a
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
%li %li
.monospace .monospace
= File.basename(file) = File.basename(file)
- if File.dirname(file).ends_with?('plugins')
.text-warning
= _('Plugins directory is deprecated and will be removed in 14.0. Please move this file into /file_hooks directory.')
- else - else
.card.bg-light.text-center .card.bg-light.text-center
.nothing-here-block= _('No file hooks found.') .nothing-here-block= _('No file hooks found.')
---
title: Deprecate /plugins directory
merge_request: 29678
author:
type: deprecated
...@@ -4,6 +4,11 @@ namespace :file_hooks do ...@@ -4,6 +4,11 @@ namespace :file_hooks do
puts 'Validating file hooks from /file_hooks and /plugins directories' puts 'Validating file hooks from /file_hooks and /plugins directories'
Gitlab::FileHook.files.each do |file| 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) success, message = Gitlab::FileHook.execute(file, Gitlab::DataBuilder::Push::SAMPLE_DATA)
if success if success
......
...@@ -15190,6 +15190,9 @@ msgstr "" ...@@ -15190,6 +15190,9 @@ msgstr ""
msgid "Please wait while we import the repository for you. Refresh at will." msgid "Please wait while we import the repository for you. Refresh at will."
msgstr "" msgstr ""
msgid "Plugins directory is deprecated and will be removed in 14.0. Please move this file into /file_hooks directory."
msgstr ""
msgid "Pod does not exist" msgid "Pod does not exist"
msgstr "" msgstr ""
......
...@@ -36,6 +36,24 @@ describe 'Admin::Hooks' do ...@@ -36,6 +36,24 @@ describe 'Admin::Hooks' do
expect(page).to have_content('foo.rb') expect(page).to have_content('foo.rb')
expect(page).to have_content('bar.clj') expect(page).to have_content('bar.clj')
end end
context 'deprecation warning' do
it 'shows warning for plugins directory' do
allow(Gitlab::FileHook).to receive(:files).and_return(['plugins/foo.rb'])
visit admin_hooks_path
expect(page).to have_content('Plugins directory is deprecated and will be removed in 14.0')
end
it 'does not show warning for file_hooks directory' do
allow(Gitlab::FileHook).to receive(:files).and_return(['file_hooks/foo.rb'])
visit admin_hooks_path
expect(page).not_to have_content('Plugins directory is deprecated and will be removed in 14.0')
end
end
end end
describe 'New Hook' do describe 'New Hook' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment