Is there a possibility to request the list of Jenkins slave ips,
inside of a Jenkins freestyle job,
when executing a shell script?
Maybe as an environment variable?
Is there a possibility to request the list of Jenkins slave ips,
inside of a Jenkins freestyle job,
when executing a shell script?
Maybe as an environment variable?
You can determine the IP address(es) of a slave node via groovy. See this answer.
So you could proceed as follows:
As an example, this groovy code will print the names and IP addresses of all slaves with label mylabel
:
import hudson.model.Computer.ListPossibleNames
slaves = Hudson.instance.slaves.findAll { it.getLabelString().split() contains 'mylabel' }
slaves.each {
println "slave '${it.name}' has these IPs: " + it.getChannel().call(new ListPossibleNames())
}
Sample output:
slave 'foo' has these IPs: [10.162.0.135]