diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-05-27 19:21:36 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-06-04 10:51:32 +0700 |
commit | 197a3d053359e66535c41935eac065ee424cbb07 (patch) | |
tree | 65b2010d5446fe8c41a378c0f9c7f359ae1eab69 /app/models | |
parent | 9a9c947b145e6a43ae49687aa398d1154d07a25b (diff) | |
download | gitlab-ce-197a3d053359e66535c41935eac065ee424cbb07.tar.gz |
Introduce sidekiq worker for auto merge processintroduce-auto-merge-process-worker
As we have a central domain for auto merge process today,
we should use a single worker for any auto merge process.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 80401ca0a1e..3727a9861aa 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -166,6 +166,16 @@ module Ci end end + after_transition any => ::Ci::Pipeline.completed_statuses do |pipeline| + pipeline.run_after_commit do + pipeline.all_merge_requests.each do |merge_request| + next unless merge_request.auto_merge_enabled? + + AutoMergeProcessWorker.perform_async(merge_request.id) + end + end + end + after_transition any => [:success, :failed] do |pipeline| pipeline.run_after_commit do PipelineNotificationWorker.perform_async(pipeline.id) |