如何使用Jenkins远程API中的树查询参数来获取下游项目和参数?

发布于 2025-01-06 14:57:23 字数 1610 浏览 4 评论 0原文

我正在尝试使用 Jenkins(Hudson) 远程 API 来使用来自 freeStyleProject 的 XML 响应。

研究 Jenkins 文档 中的树查询参数和 < a href="https://stackoverflow.com/questions/4722345/how-to-get-a-better-performance-from-hudson-ci-api">这里我一直在尝试使用它缩短获取 XML 响应的响应时间。但是 Jenkins 似乎无法使用以下 URL 生成作业的下游项目节点和构建的操作/参数:

http://localhost/job/MyJob/api/xml?depth=2&tree=名称,描述,构建[操作[参数[名称,值]]数字,url,timestamp,result],healthReport[score,description],downstreamProject[name,url]

我刚刚得到此响应 XML:

<freeStyleProject>
    <description>Description</description> 
    <name>MyJob</name> 
    <build>
        <number>2</number> 
        <result>SUCCESS</result> 
        <timestamp>1325784290000</timestamp> 
        <url>http://localhost/job/MyJob/2/</url> 
    </build>
    <build>
      <number>1</number> 
      <result>SUCCESS</result> 
      <timestamp>1323931754000</timestamp> 
      <url>http://localhost/job/MyJob/1/</url> 
    </build>
    <healthReport>
       <description>Build stability: No recent builds failed.</description> 
       <score>100</score> 
    </healthReport>
</freeStyleProject>

也许树查询参数不支持这些?使用 xpath 和排除查询参数获取此节点的唯一方法是吗?

I am trying to use Jenkins(Hudson) Remote API to consume XML response from a freeStyleProject.

Researching about the tree query parameter in the Jenkins documentation and here I have been trying to use it to improve response times to get XML response. But Jenkins seems to be unable to generate the nodes downstreamProject of the job and the action/parameter of the builds with this URL:

http://localhost/job/MyJob/api/xml?depth=2&tree=name,description,builds[action[parameter[name,value]]number,url,timestamp,result],healthReport[score,description],downstreamProject[name,url]

I just get this response XML:

<freeStyleProject>
    <description>Description</description> 
    <name>MyJob</name> 
    <build>
        <number>2</number> 
        <result>SUCCESS</result> 
        <timestamp>1325784290000</timestamp> 
        <url>http://localhost/job/MyJob/2/</url> 
    </build>
    <build>
      <number>1</number> 
      <result>SUCCESS</result> 
      <timestamp>1323931754000</timestamp> 
      <url>http://localhost/job/MyJob/1/</url> 
    </build>
    <healthReport>
       <description>Build stability: No recent builds failed.</description> 
       <score>100</score> 
    </healthReport>
</freeStyleProject>

Perhaps the tree query parameter does not support these? Would the only way to get this nodes using the xpath and exlude query parameters?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亣腦蒛氧 2025-01-13 14:57:23

对于“tree”参数,您要查找的部分是复数(其中有单数)。

行动=>动作

参数=>参数

downstreamProject => 因此,您的网址

将是:

http://localhost/job/MyJob/api/xml?depth=2&tree=name,description,builds[actions[parameters[name,value]],number,url,timestamp,结果],healthReport[分数,描述],downstreamProjects[名称,url]

For the "tree" parameter, the pieces you are looking for are plurals (where you have singulars).

action => actions

parameter => parameters

downstreamProject => downstreamProjects

So, your url would be:

http://localhost/job/MyJob/api/xml?depth=2&tree=name,description,builds[actions[parameters[name,value]],number,url,timestamp,result],healthReport[score,description],downstreamProjects[name,url]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文