0
votes

I am using the Hudson API in Jenkins written in groovy and i want to get the labels of the current slave that the script is running on. I know i can get the labels that were passed in but that's not what I want. I can get all the slaves using

hudson.model.Hudson.instance.slaves

but how do I know which one I am running on? once I have the node I can change the label using myslave.getAssignedLabels() but getting that node seems to be an issue. any suggestions?

1

1 Answers

1
votes

Use getAssignedLabels from Node class:

Computer.currentComputer().getNode().getAssignedLabels()