詹金斯:获取内部版本号范围在某一天 [英] Jenkins: Get build numbers range on a particular day

查看:198
本文介绍了詹金斯:获取内部版本号范围在某一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关数据挖掘的原因,我想打造数字范围内分别建在某一天,一个詹金斯工作。是否有完成这个或任何其他可能的方式的插件吗?

For data mining reasons, I want to get build numbers range of a jenkins job that were built on a particular day. Is there a plugin that accomplishes this or any other possible way?

谢谢,
尼克

推荐答案

内置JSON REST API会给你一个列表的建立为一个特定的工作: <$c$c>http://jenkins:8080/job/JOB_NAME/api/json?tree=builds[fullDisplayName,id,number,timestamp]&$p$ptty=true

The built-in REST JSON API will give you a list of the builds for a particular job: http://jenkins:8080/job/JOB_NAME/api/json?tree=builds[fullDisplayName,id,number,timestamp]&pretty=true

生成是这样的:

{
  "builds" : [
    {
      "fullDisplayName" : "JOB_NAME #113",
      "id" : "2014-10-31_23-05-20",
      "number" : 113,
      "timestamp" : 1414821920808
    },
    {
      "fullDisplayName" : "JOB_NAME #112",
      "id" : "2014-10-31_17-26-39",
      "number" : 112,
      "timestamp" : 1414801599000
    },
    ....

如果您的构建ID是基本的日期戳(如上),你可以做一个小字符串处理过滤结果。否则,你可以时间戳转换为相应的日期和过滤器上。

If your build ids are the basic date-stamp (as above), you can do a little string processing to filter the results. Otherwise, you can convert the timestamp to the appropriate date and filter on that.

大多数詹金斯的页面必须在提供更多的文档,虽然你经常需要使用API​​做实验,以找出细节它可以提供底部的REST API链接。

Most Jenkins pages have a REST API link at the bottom that provides more documentation, though you often need to experiment with the API to figure out what details it can provide.

更新的:作为@Nick发现,在建立结果被限制在默认情况下最新的100个元素。据这个问题詹金斯,您可以使用隐藏的 allBuilds 元素来检索的版本都。所以,如果你需要的所有的版本,使用: <$c$c>http://jenkins:8080/job/JOB_NAME/api/json?tree=allBuilds[fullDisplayName,id,number,timestamp]&$p$ptty=true

Update: As @Nick discovered, the builds result is limited to the latest 100 elements by default. According to this Jenkins issue, you can use the hidden allBuilds element to retrieve "all builds". So if you need all builds, use: http://jenkins:8080/job/JOB_NAME/api/json?tree=allBuilds[fullDisplayName,id,number,timestamp]&pretty=true

1.568詹金斯还推出分页在API结果,因此有可能检索范围的结果。詹金斯REST API链接,介绍了语法,如果您的詹金斯版本支持。

Jenkins 1.568 also introduced pagination in the API results, so it's possible to retrieve results by range. The Jenkins REST API link describes the syntax if your Jenkins version supports it.

这篇关于詹金斯:获取内部版本号范围在某一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆