Reputation: 1874
I have sample-job running on node "Windows-prod" node. How can I get the node name using groovy script?
Upvotes: 2
Views: 8040
Reputation: 18459
Your question is vague. There are two ways to run groovy scripts.. Groovy plugin on Console which runs groovy (..../script)
The following is for listing node for job using groovy console
def item = hudson.model.Hudson.instance.getItem("createAndPublishSnapshot")
def build = item.getLastBuild()
println build.isInProgress()
println build.getBuiltOn().getNodeName()
Upvotes: 1