summaryrefslogtreecommitdiff
path: root/app/workers/ci
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-09-17 18:26:22 +0900
committerAlessio Caiazza <acaiazza@gitlab.com>2018-10-02 16:57:37 +0200
commit3fc4c096a592fbc0af3a8d60d2026ed673126a2f (patch)
treec886cf4b6a4b07c47576db4fb28e3c87f2907dae /app/workers/ci
parentd5184e0d8b48bc221e1ea401b9171db07959b50c (diff)
downloadgitlab-ce-3fc4c096a592fbc0af3a8d60d2026ed673126a2f.tar.gz
Squashed commit of the following:
commit 9d9594ba20097dc4598f7eb42a9f9d78d73eae54 Author: Shinya Maeda <shinya@gitlab.com> Date: Thu Sep 13 20:18:31 2018 +0900 Cancel scheduled jobs commit f31c7172e07a9eb03b58c1e62eaa18cda4064aa6 Author: Shinya Maeda <shinya@gitlab.com> Date: Thu Sep 13 11:18:42 2018 +0900 Add Ci::BuildSchedule commit fb6b3ca638f40f9e1ee38b1fdd892bda4f6fede7 Author: Shinya Maeda <shinya@gitlab.com> Date: Wed Sep 12 20:02:50 2018 +0900 Scheduled jobs
Diffstat (limited to 'app/workers/ci')
-rw-r--r--app/workers/ci/build_schedule_worker.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/workers/ci/build_schedule_worker.rb b/app/workers/ci/build_schedule_worker.rb
new file mode 100644
index 00000000000..448fb5bf41e
--- /dev/null
+++ b/app/workers/ci/build_schedule_worker.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module Ci
+ class BuildScheduleWorker
+ include ApplicationWorker
+ include PipelineQueue
+
+ def perform(build_id)
+ ::Ci::Build.preload(:build_schedule).find_by(id: build_id).try do |build|
+ break unless build.build_schedule.present?
+
+ Ci::PlayBuildService.new(build.project, build.user).execute(build)
+ end
+ end
+ end
+end