From ae213b4f74f1f6ec3de4f5ff077597f12728606c Mon Sep 17 00:00:00 2001 From: Oliver Giles Date: Sun, 6 Aug 2017 08:21:17 +0300 Subject: [PATCH] assymetric queueing logic allow tagged job execution on an untagged node, but not vice-versa. This allows the admin to assign tags for UI grouping without worrying about nodes at all --- src/laminar.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/laminar.cpp b/src/laminar.cpp index bedb889..6793480 100644 --- a/src/laminar.cpp +++ b/src/laminar.cpp @@ -529,16 +529,16 @@ bool Laminar::nodeCanQueue(const Node& node, const Run& run) const { if(node.busyExecutors >= node.numExecutors) return false; - auto it = jobTags.find(run.name); - // if both nodes have no tags, it's OK - if(it == jobTags.end() && node.tags.size() == 0) + // if the node has no tags, allow the build + if(node.tags.size() == 0) return true; - // but if just one of them does, don't allow the build - if(it == jobTags.end() || node.tags.size() == 0) + auto it = jobTags.find(run.name); + // if the job has no tags, it cannot be run on this node + if(it == jobTags.end()) return false; - // in other cases, allow the build if they have a tag in common + // otherwise, allow the build if job and node have a tag in common for(const std::string& tag : it->second) { if(node.tags.find(tag) != node.tags.end()) return true;