diff options
author | Tiger <twatson@gitlab.com> | 2019-02-27 05:13:06 +0300 |
---|---|---|
committer | Tiger <twatson@gitlab.com> | 2019-03-20 03:48:31 +0300 |
commit | 42ca9c6f0de34dfa7ae09cc0e9672ea5857afd38 (patch) | |
tree | 1bf892761d967bdccc40397486a3ea8cf1a85cbd /app/models/ci/stage.rb | |
parent | 250f6ad27963c311e757392b886397c930d6918a (diff) |
Add :preparing status to HasStatus
Introduces a new status for builds between :created and :pending
that will be used when builds require one or more prerequisite
actions to be completed before being picked up by a runner
(such as creating Kubernetes resources before deploying).
The existing :created > :pending transition is unchanged, so
only builds that require preparation will use the :preparing
status.
Diffstat (limited to 'app/models/ci/stage.rb')
-rw-r--r-- | app/models/ci/stage.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 0389945191e..098f5189517 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -39,10 +39,14 @@ module Ci state_machine :status, initial: :created do event :enqueue do - transition created: :pending + transition [:created, :preparing] => :pending transition [:success, :failed, :canceled, :skipped] => :running end + event :prepare do + transition any - [:preparing] => :preparing + end + event :run do transition any - [:running] => :running end @@ -76,6 +80,7 @@ module Ci retry_optimistic_lock(self) do case statuses.latest.status when 'created' then nil + when 'preparing' then prepare when 'pending' then enqueue when 'running' then run when 'success' then succeed |