简体   繁体   中英

Jenkins/Hudson CLI API get the node that the script is running on using Groovy

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?

使用Node类中的getAssignedLabels

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM