From f287683929f43102d8bbac723e6ca6bc74842ae2 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 3 Oct 2018 10:51:41 +0900 Subject: Squashed commit of the following: commit 41fe9edcf75a96db2f29c172828e6adf0ca5b0c9 Merge: e5e307dd75f 42822a7d45f Author: Shinya Maeda Date: Wed Oct 3 10:33:33 2018 +0900 Merge branch 'master-ce' into scheduled-manual-jobs commit e5e307dd75f74c5e98b039332c58170dc9c2735f Author: Alessio Caiazza Date: Tue Oct 2 15:52:39 2018 +0200 delay scheduled_at evaluation in factory commit c5b2c66b0fcb1f8d1f6530b359be4310427cd98d Author: Alessio Caiazza Date: Tue Oct 2 15:50:36 2018 +0200 fix style commit 64ad6458486dc53da0a646419e4702319df6dace Author: Winnie Hellmann Date: Tue Oct 2 14:34:02 2018 +0200 Add confirmation for immediately starting scheduled jobs commit c9e8b59c8540f7be198463db4477130046a8d655 Author: Winnie Hellmann Date: Tue Oct 2 12:58:18 2018 +0200 Add missing translations from scheduled job UI commit 9613f7e2fb2d5b4190adff29107b1bca6993fd41 Author: Shinya Maeda Date: Tue Oct 2 19:45:39 2018 +0900 Stub feature flag for spec commit 7fe14c42a913c683bd6f7c4f8791fff63db3c499 Author: Shinya Maeda Date: Tue Oct 2 18:47:41 2018 +0900 Add integration spec commit 49af84c2b0df199f1d8cda16a126ce6701e07743 Author: Shinya Maeda Date: Tue Oct 2 18:35:34 2018 +0900 enqueue in process_build_service commit 4dd70b9e1e67b50d846b4fb48c0ff942104119a5 Author: Shinya Maeda Date: Tue Oct 2 18:10:58 2018 +0900 Fix spec commit f1226cd5a9240c03438ef5f24a57bce4ad3ec554 Author: Shinya Maeda Date: Tue Oct 2 17:32:49 2018 +0900 Remove scheduled job fixture commit 63829ae4e81171a7fd6bee801e90708136da573d Author: Shinya Maeda Date: Tue Oct 2 16:04:31 2018 +0900 Show sheculed label for present and past jobs commit 46fc55993a295b3832f82359d9a6ac4cd1ee8aa7 Author: Shinya Maeda Date: Tue Oct 2 13:43:45 2018 +0900 Add feature flag spec for process_build_service commit 8bc065e02dcc4582aebbc7d28a30f7468a15ccc0 Author: Shinya Maeda Date: Tue Oct 2 13:32:35 2018 +0900 Rename failure reason to stale_schedule commit 336affe911885a84c2f14193e3fa43f0320c0cb2 Author: Shinya Maeda Date: Tue Oct 2 09:44:22 2018 +0900 Add scheduled status commit 51a8177658b2a90e78b762667b37807a72d7a982 Author: Winnie Hellmann Date: Mon Oct 1 18:12:30 2018 +0200 Add badge for scheduled jobs commit fc8d4c7046807ac65e36ce65df982ff5c4ff4a9a Author: Winnie Hellmann Date: Mon Oct 1 15:21:33 2018 +0200 Add scheduled job dropdown to pipelines list commit 786ae683679d90a0e55bfe844ac694aeb7d68ce6 Author: Winnie Hellmann Date: Mon Oct 1 12:55:09 2018 +0200 Do not omit leading zeros in duration_in_numbers helper commit 6369ff1ce172cefc84574f2dde055399b64bf7b5 Author: Winnie Hellmann Date: Mon Oct 1 12:47:07 2018 +0200 Add actions to scheduled job buttons on job list page commit eb238ec16004d9d22c20193eb8a8ee6cf0df4c8b Author: Shinya Maeda Date: Mon Oct 1 19:00:34 2018 +0900 Fix scheduled icon for stages commit 533f5ca4c9f899910f9cdc4f0e0b43d619a9c7df Author: Shinya Maeda Date: Mon Oct 1 17:09:07 2018 +0900 Fix spec commit bc5d649a4c456aab4ec7eddc52d13d172a5adace Author: Shinya Maeda Date: Mon Oct 1 16:09:41 2018 +0900 Add unschedule action to status build commit 7fc74818a32a713d971582f8730b163dade8df3d Author: Shinya Maeda Date: Mon Oct 1 15:27:34 2018 +0900 Add scheduled_actions as an explicit group of actions commit 384da9279eefd7ebcdfd684ff234540d935ededd Author: Shinya Maeda Date: Mon Oct 1 13:57:11 2018 +0900 Fix spec commit efaa3669c182e68d43b68a1f4257b483aad55f01 Author: Shinya Maeda Date: Mon Oct 1 13:38:37 2018 +0900 Change the order of status_sql to avoid the query for scheduled status at the earlier step commit 70d015d1ba5adde82c6f38567ad51cfb85dae5f6 Author: Shinya Maeda Date: Mon Oct 1 13:10:30 2018 +0900 Cleanup drop_stale_scheduled_builds code commit a220e72c7027ecf48da73daf0d2de5315b4bc675 Author: Winnie Hellmann Date: Fri Sep 28 11:52:30 2018 +0200 Add black border to scheduled job badge commit fb4d06d1df731c5e13e0f464f451d66cbe389571 Author: Winnie Hellmann Date: Fri Sep 28 11:50:00 2018 +0200 Use time-out icon for unschedule job action commit 93cd5edbc1fe0023d82227ab135314d068263441 Author: Winnie Hellmann Date: Fri Sep 28 11:47:55 2018 +0200 Add black border to scheduled icon in pipeline graphs commit ef9c8520dc8d572928a2a382ab3c92214356efc3 Author: Winnie Hellmann Date: Fri Sep 28 11:28:43 2018 +0200 Upgrade gitlab-svgs to include new scheduled job assets commit 19fb42b5ca917d94b44544e596b9e474e50e0907 Author: Shinya Maeda Date: Fri Sep 28 17:26:45 2018 +0900 Add spec for Build::Factory commit 6d4511135d08aa2dc2ffa8aec236cea3ff77e1e8 Author: Shinya Maeda Date: Fri Sep 28 16:17:01 2018 +0900 Add spec for ProcessBuildService commit 97c556bf1d49d9b5362fdd18255244d2da349a17 Author: Shinya Maeda Date: Fri Sep 28 15:55:13 2018 +0900 Fix spec failure commit 54263dc1d9719f871fb2f23ecac4e0cfcabebe77 Author: Shinya Maeda Date: Fri Sep 28 14:41:39 2018 +0900 Fix coding style offence commit b5a591d8c2c8fff0136037f6c2a8b635f101e07e Author: Shinya Maeda Date: Fri Sep 28 14:30:43 2018 +0900 Include delayed jobs action into manual actions commit 308d11f4bbf48ae2ff539772c3b565a8db0bc276 Author: Winnie Hellmann Date: Thu Sep 27 14:19:44 2018 +0200 Use correct icon for scheduled jobs in pipeline graph commit ea38e832f0f197c5121504d7e193227d3d9c7867 Author: Winnie Hellmann Date: Thu Sep 27 13:44:03 2018 +0200 Allow remaining time of scheduled jobs to overflow one day commit f976418d128e9f00d6bc6e7eb2862e553e82934c Author: Winnie Hellmann Date: Thu Sep 27 13:11:24 2018 +0200 Fix URL to empty state graphic of scheduled jobs commit 52c769526cbe749b4e884238a6530df268345e26 Author: Winnie Hellmann Date: Thu Sep 27 13:08:13 2018 +0200 Upgrade gitlab-svgs to include scheduled job assets commit 9ceb61634e2cf6176bd733e1684b80f97e0bb086 Author: Shinya Maeda Date: Thu Sep 27 19:43:10 2018 +0900 Add spec for YamlProcessor commit 5e35e85acb5403ae1a992e2cd1c9618f6fc9273e Author: Shinya Maeda Date: Thu Sep 27 19:36:09 2018 +0900 Add spec for scheduled status commit 5e4824d9ed8d164ff5a8ed5bfbf1e5a0f1bf1cff Author: Shinya Maeda Date: Thu Sep 27 19:33:41 2018 +0900 Fix Status::Pipeline::Blocked spec commit fcb77970b6ca26f031d5bcf935855a91bbb35158 Author: Shinya Maeda Date: Thu Sep 27 19:32:26 2018 +0900 Fix Status::Build::Scheduled. Add spec for the class. commit eee454e142fb99646649f8b8c9ccd8626c9bd70a Author: Shinya Maeda Date: Thu Sep 27 19:08:11 2018 +0900 Fix validation methods in Config::Entry::Job. Added spec for that commit 6fb1e0d8884fb7e64cb3f98ccd84c9b4db5096ac Author: Shinya Maeda Date: Thu Sep 27 18:23:02 2018 +0900 Fix partial index for scheduled_at commit 587560757faaedb6c61ef7aa77f11934cb76084b Author: Shinya Maeda Date: Thu Sep 27 18:17:43 2018 +0900 Fix StuckCiJobsWorker and added tests commit 71fc37c9cf8aee5de3d4d43ec6ea97a56e34537d Author: Shinya Maeda Date: Thu Sep 27 17:50:50 2018 +0900 Add spec for BuildScheduleWorker and RunScheduledBuildService commit 80a92650faf9d7ca7a706b6a74019d869598fe41 Author: Shinya Maeda Date: Thu Sep 27 16:10:55 2018 +0900 Add Spec for ProcessPipelineService commit f3348951a80f11b376d5d21843f57102630e1d5d Author: Shinya Maeda Date: Thu Sep 27 14:02:24 2018 +0900 Fix coding style offence commit c6bb038c006f4cfff68666661d3a8fe257c51ed7 Author: Shinya Maeda Date: Thu Sep 27 13:59:12 2018 +0900 Fix favicon spec commit 174fd391f07439f94e0c29502384cfb0cb6582da Author: Shinya Maeda Date: Thu Sep 27 13:57:43 2018 +0900 Add schedule_expired to failed status commit b98be35b61aaf71a263ec03807ab8e5d07a9d637 Author: Shinya Maeda Date: Thu Sep 27 13:53:54 2018 +0900 Fix safe model attributes commit ddb313aebf2c499264b32567d3509f152c242d7a Author: Shinya Maeda Date: Thu Sep 27 13:52:15 2018 +0900 Remove Scheduled Status class from pipeline commit 6d712148c9595c4c87247757100ca80198cdd889 Author: Shinya Maeda Date: Thu Sep 27 13:30:16 2018 +0900 Fix build_spec commit f228f23a3243ee64cd4bdcf54d010a5eedf0b8a7 Author: Shinya Maeda Date: Thu Sep 27 13:26:08 2018 +0900 Fix process build service spec commit 8ed7b34066464758e5cab955abb7a06b44c8e677 Author: Shinya Maeda Date: Wed Sep 26 20:21:36 2018 +0900 Add unit tests for CommitStatus and Ci::Stage commit cc8b8a60b7ac9df0008192a489da6446c7fd5f89 Author: Shinya Maeda Date: Wed Sep 26 19:49:29 2018 +0900 Add unit spec for Ci::Pipeline commit 9266cd5e8b543ab356df3fba78bf9e01536a180d Author: Shinya Maeda Date: Wed Sep 26 19:12:48 2018 +0900 Add unit tests for Ci::Build. Fix validation on state transition commit 4b0aa573498dda340bc24a63164433e1de670c03 Author: Shinya Maeda Date: Wed Sep 26 15:19:56 2018 +0900 Check the precense of scheduled_at in Status::Build commit 20de2480d2431bc4afcd264fbb4aa73baa74a2b4 Author: Shinya Maeda Date: Wed Sep 26 15:15:52 2018 +0900 Fix stuck ci jobs worker commit 6eee8d2d53a327051515ec18953726fd5606c000 Author: Shinya Maeda Date: Wed Sep 26 15:13:39 2018 +0900 Fix process build service spec commit af4b85cef57c00f4cccdac7fde15d4c69d9e94fb Author: Shinya Maeda Date: Wed Sep 26 14:43:03 2018 +0900 Fix commit status presenter spec commit 44491012828af1dbda8e807b74cd14f87be34bbd Author: Shinya Maeda Date: Wed Sep 26 14:39:05 2018 +0900 Remove unnecessary change from schema.rb commit 173300370a77f84b06755498b488cb68547eb1b3 Author: Shinya Maeda Date: Wed Sep 26 14:37:11 2018 +0900 Fix retry_build_service_spec commit c514636a83987152b2a95e442f49b3ee61dcbeb8 Author: Shinya Maeda Date: Wed Sep 26 14:28:22 2018 +0900 Simplify StuckCiJobsWorker commit b1d24c0d14afdf3312e8f0745cc5ba87e41004b4 Author: Shinya Maeda Date: Tue Sep 25 18:44:08 2018 +0900 Fix stuck job worker. Fix sidekiq queue namespace commit c9077a0efdca065f848e3698c3afd5251a135049 Author: Shinya Maeda Date: Tue Sep 25 15:18:02 2018 +0900 Add cleanup mechanizm for stale scheduled jobs commit f76f6df19377945609c7e68103077ef04b0702fb Author: Shinya Maeda Date: Tue Sep 25 14:39:32 2018 +0900 Add feature flag to schedulable? method commit e0cfa9279cc8620f64bfceebc743a8c245be215c Author: Shinya Maeda Date: Tue Sep 25 14:30:11 2018 +0900 Execute the worker in pipeline_processing queue commit c6e4b6a7d9afd3c8561bc1cddebf8dd05f5534ae Author: Shinya Maeda Date: Tue Sep 25 14:27:00 2018 +0900 Optimize query format commit 27a4c03502c4eca0be03a81a27c6a9d5f5e4967e Author: Shinya Maeda Date: Tue Sep 25 14:24:08 2018 +0900 Rename to process build service commit 2f03c503fb299a4a821d74f75c31aa1189fcbccb Author: Shinya Maeda Date: Tue Sep 25 14:21:41 2018 +0900 Introduce ProceedBuildService commit 422970c93eb0ff445da5c3351cdfd70bb387e57c Author: Shinya Maeda Date: Mon Sep 24 20:07:18 2018 +0900 Remove unnecessary table commit 703a41f8862c7278559ff13f2aa4f39ffd660c4e Author: Shinya Maeda Date: Mon Sep 24 20:02:26 2018 +0900 Introduce enqueue_scheduled event commit f97ec4b8f44152036a8f8242bcf1584cfbd56cec Author: Shinya Maeda Date: Mon Sep 24 19:17:04 2018 +0900 Add scheduled_at column to ci_builds, and add a partial index as well commit 571a934f29bee7af9569176e62e5376b471e35fb Author: Shinya Maeda Date: Mon Sep 24 13:12:11 2018 +0900 Fix spec. Create scheduled status entry for pipeline commit f8e680b786377443471780d9a096dfb2b873de4a Author: Shinya Maeda Date: Fri Sep 21 17:44:15 2018 +0900 Fix rubocop offence commit ffbc0b1c291233a05e6729bf6031ee43b61798e4 Author: Shinya Maeda Date: Fri Sep 21 15:42:29 2018 +0900 Remove whitespace commit 532be543a5e6d1f7ef402f41ecdf091ef9eee72a Author: Shinya Maeda Date: Fri Sep 21 15:40:24 2018 +0900 Add changelog commit 1a4f497e6093c8d1005986467c8b752cc61c6629 Author: Shinya Maeda Date: Fri Sep 21 15:24:19 2018 +0900 Update pipelines and stages status as well commit a7c767f16446f71f6e35a5aa3d2fdc73037fcdf5 Author: Shinya Maeda Date: Fri Sep 21 11:17:37 2018 +0900 Add a new status to ci_builds.status commit af51b95442aa867bd570b99d32f8b580f554675d Author: Winnie Hellmann Date: Thu Sep 20 09:31:08 2018 +0200 Add button group for scheduled jobs commit 33304b32573ac8215e24d17cff52c5a0c7bbed2e Author: Winnie Hellmann Date: Thu Sep 20 09:30:43 2018 +0200 Use secondary color for SVG icons in CI buttons commit 7fffe0fb37fae4944b1a154e04a44006cee528f2 Author: Winnie Hellmann Date: Thu Sep 20 09:29:41 2018 +0200 Ensure that execute_in of a build schedule is not negative commit f9877d715fd9ac152a8b7e88d4e740c95cb0b962 Author: Winnie Hellmann Date: Thu Sep 20 08:18:49 2018 +0200 Add placeholders to debug script example commit 1a6a59d6bc3ab2fc43cd3537ef9d8deea7398cc9 Author: Shinya Maeda Date: Tue Sep 18 16:12:13 2018 +0900 Add unschedule endpont to job controller commit 22e00b08e89f72eb0fefea2d1d623667c4461773 Author: Shinya Maeda Date: Tue Sep 18 15:53:31 2018 +0900 Make schedule and unschedule consistent commit e265fc3e28dbfe53d96646588a1587d5626e92de Author: Shinya Maeda Date: Tue Sep 18 15:36:03 2018 +0900 Rename delayed to scheduled commit a5d296e9be7cc48ddc75d04b117ae62bae7c9f5b Author: Shinya Maeda Date: Tue Sep 18 14:45:17 2018 +0900 replace images commit 8720edd45acc50473cb080c18c4b259079674e0a Author: Shinya Maeda Date: Tue Sep 18 14:20:59 2018 +0900 Add debug script commit c03631a99618d43c66a1b9d0b4303d7253e45866 Author: Shinya Maeda Date: Mon Sep 17 20:00:29 2018 +0900 Support new syntax commit 3fc4c096a592fbc0af3a8d60d2026ed673126a2f Author: Shinya Maeda Date: Mon Sep 17 18:26:22 2018 +0900 Squashed commit of the following: commit 9d9594ba20097dc4598f7eb42a9f9d78d73eae54 Author: Shinya Maeda Date: Thu Sep 13 20:18:31 2018 +0900 Cancel scheduled jobs commit f31c7172e07a9eb03b58c1e62eaa18cda4064aa6 Author: Shinya Maeda Date: Thu Sep 13 11:18:42 2018 +0900 Add Ci::BuildSchedule commit fb6b3ca638f40f9e1ee38b1fdd892bda4f6fede7 Author: Shinya Maeda Date: Wed Sep 12 20:02:50 2018 +0900 Scheduled jobs --- lib/api/jobs.rb | 2 +- lib/gitlab/ci/config/entry/job.rb | 15 ++++++++--- lib/gitlab/ci/status/build/factory.rb | 2 ++ lib/gitlab/ci/status/build/failed.rb | 3 ++- lib/gitlab/ci/status/build/scheduled.rb | 38 +++++++++++++++++++++++++++ lib/gitlab/ci/status/build/unschedule.rb | 41 ++++++++++++++++++++++++++++++ lib/gitlab/ci/status/pipeline/factory.rb | 1 + lib/gitlab/ci/status/pipeline/scheduled.rb | 21 +++++++++++++++ lib/gitlab/ci/status/scheduled.rb | 23 +++++++++++++++++ lib/gitlab/ci/yaml_processor.rb | 3 ++- 10 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 lib/gitlab/ci/status/build/scheduled.rb create mode 100644 lib/gitlab/ci/status/build/unschedule.rb create mode 100644 lib/gitlab/ci/status/pipeline/scheduled.rb create mode 100644 lib/gitlab/ci/status/scheduled.rb (limited to 'lib') diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index 63fab6b0abb..fa992b9a440 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -151,7 +151,7 @@ module API present build, with: Entities::Job end - desc 'Trigger a manual job' do + desc 'Trigger a actionable job (manual, scheduled, etc)' do success Entities::Job detail 'This feature was added in GitLab 8.11' end diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 016a896bde5..03971254310 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -10,7 +10,7 @@ module Gitlab include Attributable ALLOWED_KEYS = %i[tags script only except type image services - allow_failure type stage when artifacts cache + allow_failure type stage when start_in artifacts cache dependencies before_script after_script variables environment coverage retry extends].freeze @@ -28,13 +28,16 @@ module Gitlab greater_than_or_equal_to: 0, less_than_or_equal_to: 2 } validates :when, - inclusion: { in: %w[on_success on_failure always manual], + inclusion: { in: %w[on_success on_failure always manual delayed], message: 'should be on_success, on_failure, ' \ - 'always or manual' } + 'always, manual or delayed' } validates :dependencies, array_of_strings: true validates :extends, type: String end + + validates :start_in, duration: true, if: :delayed? + validates :start_in, absence: true, unless: :delayed? end entry :before_script, Entry::Script, @@ -84,7 +87,7 @@ module Gitlab :artifacts, :commands, :environment, :coverage, :retry attributes :script, :tags, :allow_failure, :when, :dependencies, - :retry, :extends + :retry, :extends, :start_in def compose!(deps = nil) super do @@ -114,6 +117,10 @@ module Gitlab self.when == 'manual' end + def delayed? + self.when == 'delayed' + end + def ignored? allow_failure.nil? ? manual_action? : allow_failure end diff --git a/lib/gitlab/ci/status/build/factory.rb b/lib/gitlab/ci/status/build/factory.rb index 2b26ebb45a1..4a74d6d6ed1 100644 --- a/lib/gitlab/ci/status/build/factory.rb +++ b/lib/gitlab/ci/status/build/factory.rb @@ -5,6 +5,7 @@ module Gitlab class Factory < Status::Factory def self.extended_statuses [[Status::Build::Erased, + Status::Build::Scheduled, Status::Build::Manual, Status::Build::Canceled, Status::Build::Created, @@ -14,6 +15,7 @@ module Gitlab Status::Build::Retryable], [Status::Build::Failed], [Status::Build::FailedAllowed, + Status::Build::Unschedule, Status::Build::Play, Status::Build::Stop], [Status::Build::Action], diff --git a/lib/gitlab/ci/status/build/failed.rb b/lib/gitlab/ci/status/build/failed.rb index 2fa9a0d4541..50b0d044265 100644 --- a/lib/gitlab/ci/status/build/failed.rb +++ b/lib/gitlab/ci/status/build/failed.rb @@ -10,7 +10,8 @@ module Gitlab stuck_or_timeout_failure: 'stuck or timeout failure', runner_system_failure: 'runner system failure', missing_dependency_failure: 'missing dependency failure', - runner_unsupported: 'unsupported runner' + runner_unsupported: 'unsupported runner', + stale_schedule: 'stale schedule' }.freeze private_constant :REASONS diff --git a/lib/gitlab/ci/status/build/scheduled.rb b/lib/gitlab/ci/status/build/scheduled.rb new file mode 100644 index 00000000000..eebb3f761c5 --- /dev/null +++ b/lib/gitlab/ci/status/build/scheduled.rb @@ -0,0 +1,38 @@ +module Gitlab + module Ci + module Status + module Build + class Scheduled < Status::Extended + def illustration + { + image: 'illustrations/illustrations_scheduled-job_countdown.svg', + size: 'svg-394', + title: _("This is a scheduled to run in ") + " #{execute_in}", + content: _("This job will automatically run after it's timer finishes. " \ + "Often they are used for incremental roll-out deploys " \ + "to production environments. When unscheduled it converts " \ + "into a manual action.") + } + end + + def status_tooltip + "scheduled manual action (#{execute_in})" + end + + def self.matches?(build, user) + build.scheduled? && build.scheduled_at + end + + private + + include TimeHelper + + def execute_in + remaining_seconds = [0, subject.scheduled_at - Time.now].max + duration_in_numbers(remaining_seconds, true) + end + end + end + end + end +end diff --git a/lib/gitlab/ci/status/build/unschedule.rb b/lib/gitlab/ci/status/build/unschedule.rb new file mode 100644 index 00000000000..e1b7b83428c --- /dev/null +++ b/lib/gitlab/ci/status/build/unschedule.rb @@ -0,0 +1,41 @@ +module Gitlab + module Ci + module Status + module Build + class Unschedule < Status::Extended + def label + 'unschedule action' + end + + def has_action? + can?(user, :update_build, subject) + end + + def action_icon + 'time-out' + end + + def action_title + 'Unschedule' + end + + def action_button_title + _('Unschedule job') + end + + def action_path + unschedule_project_job_path(subject.project, subject) + end + + def action_method + :post + end + + def self.matches?(build, user) + build.scheduled? + end + end + end + end + end +end diff --git a/lib/gitlab/ci/status/pipeline/factory.rb b/lib/gitlab/ci/status/pipeline/factory.rb index 17f9a75f436..00d8f01cbdc 100644 --- a/lib/gitlab/ci/status/pipeline/factory.rb +++ b/lib/gitlab/ci/status/pipeline/factory.rb @@ -5,6 +5,7 @@ module Gitlab class Factory < Status::Factory def self.extended_statuses [[Status::SuccessWarning, + Status::Pipeline::Scheduled, Status::Pipeline::Blocked]] end diff --git a/lib/gitlab/ci/status/pipeline/scheduled.rb b/lib/gitlab/ci/status/pipeline/scheduled.rb new file mode 100644 index 00000000000..9ec6994bd2f --- /dev/null +++ b/lib/gitlab/ci/status/pipeline/scheduled.rb @@ -0,0 +1,21 @@ +module Gitlab + module Ci + module Status + module Pipeline + class Scheduled < Status::Extended + def text + s_('CiStatusText|scheduled') + end + + def label + s_('CiStatusLabel|waiting for delayed job') + end + + def self.matches?(pipeline, user) + pipeline.scheduled? + end + end + end + end + end +end diff --git a/lib/gitlab/ci/status/scheduled.rb b/lib/gitlab/ci/status/scheduled.rb new file mode 100644 index 00000000000..542100e41da --- /dev/null +++ b/lib/gitlab/ci/status/scheduled.rb @@ -0,0 +1,23 @@ +module Gitlab + module Ci + module Status + class Scheduled < Status::Core + def text + s_('CiStatusText|scheduled') + end + + def label + s_('CiStatusLabel|scheduled') + end + + def icon + 'status_scheduled' + end + + def favicon + 'favicon_status_scheduled' + end + end + end + end +end diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb index 5d1864ae9e2..a427aa30683 100644 --- a/lib/gitlab/ci/yaml_processor.rb +++ b/lib/gitlab/ci/yaml_processor.rb @@ -49,7 +49,8 @@ module Gitlab script: job[:script], after_script: job[:after_script], environment: job[:environment], - retry: job[:retry] + retry: job[:retry], + start_in: job[:start_in] }.compact } end -- cgit v1.2.3