I\'m creating a Jenkins pipeline job and I need to run a job on all nodes labelled with a certain label.
Therefore I\'m trying to get a list of node names assigned with
Try using for (aSlave in hudson.model.Hudson.instance.slaves) {} and aSlave.getLabelString()); to get all the labels for all of your nodes. You can construct a list of nodes per label this way.
for (aSlave in hudson.model.Hudson.instance.slaves) {}
aSlave.getLabelString());