summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
authorTiger <twatson@gitlab.com>2019-03-04 10:56:20 +1100
committerTiger <twatson@gitlab.com>2019-03-20 12:04:40 +1100
commit00f0d356b71fa87f8190810b01add0cc4586e90a (patch)
treee6b59c822bba6db3ea1e80079e644d010b84f806 /app/models/commit_status.rb
parent42ca9c6f0de34dfa7ae09cc0e9672ea5857afd38 (diff)
downloadgitlab-ce-00f0d356b71fa87f8190810b01add0cc4586e90a.tar.gz
Create framework for build prerequisites
Introduces the concept of Prerequisites for a CI build. If a build has unmet prerequisites it will go through the :preparing state before being made available to a runner. There are no actual prerequisites yet, so current behaviour is unchanged.
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index bfb13fa0ce8..5f66a661324 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -66,7 +66,10 @@ class CommitStatus < ActiveRecord::Base
end
event :enqueue do
- transition [:created, :preparing, :skipped, :manual, :scheduled] => :pending
+ # A CommitStatus will never have prerequisites, but this event
+ # is shared by Ci::Build, which cannot progress unless prerequisites
+ # are satisfied.
+ transition [:created, :preparing, :skipped, :manual, :scheduled] => :pending, unless: :any_unmet_prerequisites?
end
event :run do
@@ -180,6 +183,10 @@ class CommitStatus < ActiveRecord::Base
false
end
+ def any_unmet_prerequisites?
+ false
+ end
+
def auto_canceled?
canceled? && auto_canceled_by_id?
end