diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-18 13:08:51 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-18 13:08:51 +0000 |
commit | 924e00496c7d16887447b9384b66b555e5a9f911 (patch) | |
tree | ddf51b4cef3aa68eef7450a4c00eb28084f80eb9 /app/workers | |
parent | 38dd7263e15e84c08b62c97028e943c759384b94 (diff) | |
parent | 4b0465f20de1bf58326c7daf6876b63438f00d84 (diff) | |
download | gitlab-ce-924e00496c7d16887447b9384b66b555e5a9f911.tar.gz |
Merge branch 'sh-add-schedule-pipeline-run-now' into 'master'
Add button to run scheduled pipeline immediately
Closes #38741
See merge request gitlab-org/gitlab-ce!15700
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/run_pipeline_schedule_worker.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/workers/run_pipeline_schedule_worker.rb b/app/workers/run_pipeline_schedule_worker.rb new file mode 100644 index 00000000000..7725ad319a3 --- /dev/null +++ b/app/workers/run_pipeline_schedule_worker.rb @@ -0,0 +1,22 @@ +class RunPipelineScheduleWorker + include ApplicationWorker + include PipelineQueue + + enqueue_in group: :creation + + def perform(schedule_id, user_id) + schedule = Ci::PipelineSchedule.find_by(id: schedule_id) + user = User.find_by(id: user_id) + + return unless schedule && user + + 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 |