List of Slaves connected to master - Hudson

百般思念 提交于 2019-12-08 15:58:24

问题


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.


回答1:


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




回答2:


Groovy script to get all computers:

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

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



回答3:


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



来源:https://stackoverflow.com/questions/3202270/list-of-slaves-connected-to-master-hudson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!