Skip to content

Commit

Permalink
Rework the findAll to support label expressions
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <jrivero@honurobotics.com>
  • Loading branch information
j-rivero committed Feb 27, 2025
1 parent 1209405 commit 88c4309
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions jenkins-scripts/tools/label-assignment-backstop.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ for (tup in exactly_one_labels) {
println("No online host currently has the label ${nightly_label}")
println("Appointing a node from the configured pool matching '${pool_label}'")

def node_pool = Jenkins.instance.nodes.findAll { node ->
def node_pool = Label.get(pool_label).getNodes().findAll { node ->
node.toComputer()?.isOnline() &&
node.getLabelString().contains(pool_label) &&
!node.getLabelString().contains(nightly_label_prefix) &&
!node.getLabelString().contains("test-instance")
}

if (node_pool.size() <= 0) {
println("The Pool of '${pool_label}' machines for ${nightly_label} is empty. Reusing a node:")
node_pool = Jenkins.instance.nodes.findAll { node ->
node_pool = Label.get(pool_label).getNodes().findAll { node ->
node.toComputer()?.isOnline() &&
node.getLabelString().contains(pool_label) &&
!node.getLabelString().contains("test-instance")
}
}
Expand Down

0 comments on commit 88c4309

Please sign in to comment.