1

I can look into the slave's status to find all projects tie to this slave. Is there a way, e.g. groovy script, to list all of them? We used to have half a dozen slaves, now want to consolidate them. I want to have a nicely list send out to the project team.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jirong Hu
  • 2,315
  • 8
  • 40
  • 63
  • A similar question but not the same: http://stackoverflow.com/questions/30882670/list-all-jobs-which-were-running-on-a-specific-slave-node – Jirong Hu Jul 15 '16 at 20:50

1 Answers1

0

You can use getTiedJobs() method of getComputer()

for (slave in hudson.model.Hudson.instance.slaves) {
   println('Name: ' + slave.name);
   println('TiedJobs: ' + slave.getComputer().getTiedJobs());
} 

http://javadoc.jenkins.io/hudson/model/Computer.html#getTiedJobs()

Igor Zilberman
  • 1,048
  • 1
  • 11
  • 16