summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-05-19 21:54:33 +0000
committerRobert Speicher <robert@gitlab.com>2016-05-19 21:54:33 +0000
commitf26389a02a48a53cccb3bb7dd1d7bcd4858c118d (patch)
treee075ed3e3a0446cc5e0a323ba50f895c0778c49b /app/models/ci/build.rb
parentf73def90a83e7cddda0960b2c780c59835c228fb (diff)
parent52c8b9da37451943fe97f3a687d43ae39105aaa0 (diff)
downloadgitlab-ce-f26389a02a48a53cccb3bb7dd1d7bcd4858c118d.tar.gz
Merge branch 'feature/runner-config-untagged-jobs' into 'master'
Add config for CI Runner that prevents it from picking untagged jobs Closes #3456 See merge request !4039
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 50190101f2b..ff7dd44c526 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -291,9 +291,15 @@ module Ci
end
def can_be_served?(runner)
+ return false unless has_tags? || runner.run_untagged?
+
(tag_list - runner.tag_list).empty?
end
+ def has_tags?
+ tag_list.any?
+ end
+
def any_runners_online?
project.any_runners? { |runner| runner.active? && runner.online? && can_be_served?(runner) }
end