diff options
Diffstat (limited to 'app/models/ci/stage.rb')
-rw-r--r-- | app/models/ci/stage.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 0389945191e..b25b0369666 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Ci - class Stage < ActiveRecord::Base + class Stage < ApplicationRecord extend Gitlab::Ci::Model include Importable include HasStatus @@ -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 |