List of Slaves connected to master - Hudson

2019-06-16 06:50发布

Is there a way to find it programatically? I need this as part of an automated run; So this would be very helpful if there is an existing remote API call which can give this.

3条回答
2楼-- · 2019-06-16 07:23

You don't need to parse the HTML - most of the Hudson pages can be turned into API calls by adding URL suffix, e.g.

Make GET calls to:

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

switch the json for xml or python if you prefer over json

if you use just the api suffix, you'll get a short generic help page on the api

查看更多
太酷不给撩
3楼-- · 2019-06-16 07:38

Look at http://hudson:8080/computer/

查看更多
够拽才男人
4楼-- · 2019-06-16 07:41

Groovy script to get all computers:

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

computers.each{ 
  println "${it.displayName} ${it.hostName}"
}
查看更多
登录 后发表回答