2017-12-03 01:55:49 -05:00
|
|
|
class RunPipelineScheduleWorker
|
2017-12-08 02:58:05 -05:00
|
|
|
include ApplicationWorker
|
2017-12-03 01:55:49 -05:00
|
|
|
include PipelineQueue
|
|
|
|
|
2017-12-18 10:42:31 -05:00
|
|
|
queue_namespace :pipeline_creation
|
2017-12-03 01:55:49 -05:00
|
|
|
|
|
|
|
def perform(schedule_id, user_id)
|
2017-12-06 01:24:20 -05:00
|
|
|
schedule = Ci::PipelineSchedule.find_by(id: schedule_id)
|
|
|
|
user = User.find_by(id: user_id)
|
|
|
|
|
|
|
|
return unless schedule && user
|
2017-12-03 01:55:49 -05:00
|
|
|
|
|
|
|
run_pipeline_schedule(schedule, user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_pipeline_schedule(schedule, user)
|
|
|
|
Ci::CreatePipelineService.new(schedule.project,
|
|
|
|
user,
|
|
|
|
ref: schedule.ref)
|
|
|
|
.execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
|
|
|
|
end
|
|
|
|
end
|