diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-06 10:17:27 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-19 23:01:53 +0300 |
commit | 8001eed06e5871f1cb108ceb70213c8b3f9192d2 (patch) | |
tree | 4c9aeb9857ccc41fc333deaad2d0783a44ee9dc9 /app | |
parent | 8252333183dcff74fd229ca81e7317641ad30791 (diff) |
Add method that check if build has tags
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 77a2dec4f72..6c9ce0dc481 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -290,13 +290,15 @@ module Ci end def can_be_served?(runner) - if tag_list.empty? && !runner.run_untagged? - return false - end + 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 |