blob: b40408cf647af2d364eab4ae9f6551157749a10d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# frozen_string_literal: true
module MergeRequests
class CreatePipelineWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
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, params = {})
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
push_options = params.with_indifferent_access[:push_options]
MergeRequests::CreatePipelineService
.new(project: project, current_user: user, params: { push_options: push_options })
.execute(merge_request)
merge_request.update_head_pipeline
end
end
end
|