Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/stage.rb')
-rw-r--r--app/models/ci/stage.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb
index 96041e02337..75f73429c2a 100644
--- a/app/models/ci/stage.rb
+++ b/app/models/ci/stage.rb
@@ -13,9 +13,12 @@ module Ci
belongs_to :pipeline
has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id
+ has_many :processables, class_name: 'Ci::Processable', foreign_key: :stage_id
has_many :builds, foreign_key: :stage_id
has_many :bridges, foreign_key: :stage_id
+ scope :ordered, -> { order(position: :asc) }
+
with_options unless: :importing? do
validates :project, presence: true
validates :pipeline, presence: true
@@ -80,9 +83,8 @@ module Ci
end
end
- def update_status
+ def set_status(new_status)
retry_optimistic_lock(self) do
- new_status = latest_stage_status.to_s
case new_status
when 'created' then nil
when 'waiting_for_resource' then request_resource
@@ -102,6 +104,10 @@ module Ci
end
end
+ def update_legacy_status
+ set_status(latest_stage_status.to_s)
+ end
+
def groups
@groups ||= Ci::Group.fabricate(self)
end