List of subordinates connected to the master - Hudson

Is there any way to find it programmatically? I need this as part of an automatic start; Thus, this would be very useful if there is an existing remote API call that can give this.

+3
source share
3 answers

You don’t need to parse HTML - most Hudson pages can be turned into API calls by adding a URL suffix, for example.

Make GET calls:

http: // hudson: 8080 / computer / api / json

switch json for xml or python if you prefer json

if you use api suffix only, you will get a short general api help page

+17
source

Groovy script to get all computers:

def jenkins = Jenkins.instance
def computers = jenkins.computers

computers.each{ 
  println "${it.displayName} ${it.hostName}"
}
+4

http://hudson:8080/computer/

+3

Source: https://habr.com/ru/post/1753674/


All Articles