0

I have the following code setup that fetches nodes instance for multiple nodes that are co-existing for our Jenkins setup:

Object nodes = Jenkins.getInstance().getLabel(label).getNodes()

for (int i = 0; i < nodes.size(); i++) {
    Object computer = nodes[i].getComputer()
    String nodeName = nodes[i].getNodeName()
}

Now inside the for loop I have computer and nodename available. But I need to know the IP address of each of these nodes. I am pretty new to groovy and Jenkins, so wanted to know if there is a method that I can call to directly get the IP address inside the for loop above.

Aayush
  • 133
  • 1
  • 3
  • 11
  • Hope this helps: https://stackoverflow.com/questions/14930329/finding-ip-of-a-jenkins-node – Sourav Apr 06 '21 at 08:17
  • So do you think this will work: "computer.getChannel().call(new ListPossibleNames())" ? – Aayush Apr 06 '21 at 08:36
  • Apply in your code and check which answer is working. – Sourav Apr 06 '21 at 08:58
  • Does this answer your question? [Finding IP of a Jenkins node](https://stackoverflow.com/questions/14930329/finding-ip-of-a-jenkins-node) – MaratC Apr 06 '21 at 09:04

0 Answers0