jenkins api中的节点标签 [英] node labels from jenkins api
本文介绍了jenkins api中的节点标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以从jenkins API中提取节点标签吗? 标准:
Is there any way I can extract node labels from jenkins API? The standard:
{base_url}/computer/{node}/api
似乎没有任何标签信息.在其他地方吗?
did not seem to have any label information. Is it in some other place?
推荐答案
显然,节点标签是节点配置的一部分,因此它们位于
Apparently, node labels are part of node configuration, so they live in
{base_url}/computer/{node_str}/config.xml
这是我的黑客,可以从node_str
Here is my hack to access that through python jenkinsapi (similar to job configuration), from node_str
import xml.etree.ElementTree as ET
from jenkinsapi.jenkins import Jenkins
j = Jenkins(...)
n = j.get_node(node_str)
response = n.jenkins.requester.get_and_confirm_status( "%(baseurl)s/config.xml" % n.__dict__)
_element_tree = ET.fromstring(response.text)
node_labels = _element_tree.find('label').text
这篇关于jenkins api中的节点标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文