diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-03-01 13:51:36 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-01 13:51:36 +0300 |
commit | 7aa9ec7aa11fee1de915a15c15b5ee164b2f51a4 (patch) | |
tree | 696fa6fb298a54561960c7e7d43e6a81173bf98b /app | |
parent | bac9bb1866f47f0b1515b8705ea9eba1fa9b9ced (diff) | |
parent | a96ba41f229bd3606696e8e3a6500730e6cb8f63 (diff) |
Merge branch 'dz-system-hooks-plugins' into 'master'
Add ability to use external plugins as system hooks
See merge request gitlab-org/gitlab-ce!17003
Diffstat (limited to 'app')
-rw-r--r-- | app/services/system_hooks_service.rb | 2 | ||||
-rw-r--r-- | app/workers/all_queues.yml | 1 | ||||
-rw-r--r-- | app/workers/plugin_worker.rb | 15 |
3 files changed, 18 insertions, 0 deletions
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index a6b7a6e1416..af8c02a10b7 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -11,6 +11,8 @@ class SystemHooksService SystemHook.hooks_for(hooks_scope).find_each do |hook| hook.async_execute(data, 'system_hooks') end + + Gitlab::Plugin.execute_all_async(data) end private diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 28a5e5da037..a9415410f8a 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -84,6 +84,7 @@ - new_note - pages - pages_domain_verification +- plugin - post_receive - process_commit - project_cache diff --git a/app/workers/plugin_worker.rb b/app/workers/plugin_worker.rb new file mode 100644 index 00000000000..bfcc683d99a --- /dev/null +++ b/app/workers/plugin_worker.rb @@ -0,0 +1,15 @@ +class PluginWorker + include ApplicationWorker + + sidekiq_options retry: false + + def perform(file_name, data) + success, message = Gitlab::Plugin.execute(file_name, data) + + unless success + Gitlab::PluginLogger.error("Plugin Error => #{file_name}: #{message}") + end + + true + end +end |