diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-09-21 11:17:37 +0900 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-02 17:02:11 +0200 |
commit | a7c767f16446f71f6e35a5aa3d2fdc73037fcdf5 (patch) | |
tree | 6f0f2a85f44d796a31ae0813e1ce6d5434bc8fda /lib | |
parent | af51b95442aa867bd570b99d32f8b580f554675d (diff) | |
download | gitlab-ce-a7c767f16446f71f6e35a5aa3d2fdc73037fcdf5.tar.gz |
Add a new status to ci_builds.status
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/jobs.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 12 | ||||
-rw-r--r-- | lib/gitlab/ci/status/build/scheduled.rb | 2 |
3 files changed, 10 insertions, 6 deletions
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 02589d147ef..3ad048883af 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -35,11 +35,11 @@ module Gitlab validates :dependencies, array_of_strings: true validates :extends, type: String - with_options if: :manual_action? do - validates :start_in, duration: true, allow_nil: true + with_options if: :delayed? do + validates :start_in, duration: true, allow_nil: false end - with_options unless: :manual_action? do + with_options unless: :delayed? do validates :start_in, presence: false end end @@ -119,7 +119,11 @@ module Gitlab end def manual_action? - %w[manual delayed].include?(self.when) + self.when == 'manual' + end + + def delayed? + self.when == 'delayed' end def ignored? diff --git a/lib/gitlab/ci/status/build/scheduled.rb b/lib/gitlab/ci/status/build/scheduled.rb index 93da8fb9538..010d5e2142f 100644 --- a/lib/gitlab/ci/status/build/scheduled.rb +++ b/lib/gitlab/ci/status/build/scheduled.rb @@ -39,7 +39,7 @@ module Gitlab end def self.matches?(build, user) - build.schedulable? && !build.canceled? + build.scheduled? end private |