summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-02-27 13:13:06 +1100
committerTiger <twatson@gitlab.com>2019-03-20 11:48:31 +1100
commit42ca9c6f0de34dfa7ae09cc0e9672ea5857afd38 (patch)
tree1bf892761d967bdccc40397486a3ea8cf1a85cbd /app/models/commit_status.rb
parent250f6ad27963c311e757392b886397c930d6918a (diff)
downloadgitlab-ce-42ca9c6f0de34dfa7ae09cc0e9672ea5857afd38.tar.gz
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/commit_status.rb')
-rw-r--r--app/models/commit_status.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 7f6562b63e5..bfb13fa0ce8 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -66,7 +66,7 @@ class CommitStatus < ActiveRecord::Base
end
event :enqueue do
- transition [:created, :skipped, :manual, :scheduled] => :pending
+ transition [:created, :preparing, :skipped, :manual, :scheduled] => :pending
end
event :run do
@@ -74,26 +74,26 @@ class CommitStatus < ActiveRecord::Base
end
event :skip do
- transition [:created, :pending] => :skipped
+ transition [:created, :preparing, :pending] => :skipped
end
event :drop do
- transition [:created, :pending, :running, :scheduled] => :failed
+ transition [:created, :preparing, :pending, :running, :scheduled] => :failed
end
event :success do
- transition [:created, :pending, :running] => :success
+ transition [:created, :preparing, :pending, :running] => :success
end
event :cancel do
- transition [:created, :pending, :running, :manual, :scheduled] => :canceled
+ transition [:created, :preparing, :pending, :running, :manual, :scheduled] => :canceled
end
- before_transition [:created, :skipped, :manual, :scheduled] => :pending do |commit_status|
+ before_transition [:created, :preparing, :skipped, :manual, :scheduled] => :pending do |commit_status|
commit_status.queued_at = Time.now
end
- before_transition [:created, :pending] => :running do |commit_status|
+ before_transition [:created, :preparing, :pending] => :running do |commit_status|
commit_status.started_at = Time.now
end