diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-19 21:54:33 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-19 21:54:33 +0000 |
commit | f26389a02a48a53cccb3bb7dd1d7bcd4858c118d (patch) | |
tree | e075ed3e3a0446cc5e0a323ba50f895c0778c49b /app/models/ci/build.rb | |
parent | f73def90a83e7cddda0960b2c780c59835c228fb (diff) | |
parent | 52c8b9da37451943fe97f3a687d43ae39105aaa0 (diff) | |
download | gitlab-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.rb | 6 |
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 |