diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/workers/merge_requests/create_pipeline_worker.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/workers/merge_requests/create_pipeline_worker.rb')
-rw-r--r-- | app/workers/merge_requests/create_pipeline_worker.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/workers/merge_requests/create_pipeline_worker.rb b/app/workers/merge_requests/create_pipeline_worker.rb new file mode 100644 index 00000000000..244ba1af300 --- /dev/null +++ b/app/workers/merge_requests/create_pipeline_worker.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module MergeRequests + class CreatePipelineWorker + include ApplicationWorker + include PipelineQueue + + queue_namespace :pipeline_creation + feature_category :continuous_integration + urgency :high + worker_resource_boundary :cpu + idempotent! + + def perform(project_id, user_id, merge_request_id) + project = Project.find_by_id(project_id) + return unless project + + user = User.find_by_id(user_id) + return unless user + + merge_request = MergeRequest.find_by_id(merge_request_id) + return unless merge_request + + MergeRequests::CreatePipelineService.new(project, user).execute(merge_request) + merge_request.update_head_pipeline + end + end +end |