Artifactory aql: find builds of job with given property

后端 未结 2 613
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-21 18:36

I am trying to query which build number(s) produced artifacts from build foo with artifact property vcs.Revision=aabbccddee123456.

In Artif

2条回答
  •  盖世英雄少女心
    2020-12-21 18:58

    Here's a working solution that will give build numbers (since giving admin rights to query builds is not a solution for us):

    query.json:

    items.find(
    {
      "repo":"snapshot-local",
      "artifact.module.build.name":"foo",
      "artifact.item.@vcs.Revision":"aabbccddee123456"
    }
    ).include("artifact.module.build.number")
    

    This returns a list of all the artifacts that were built with the relevant properties, with the build number attached, e.g:

    {
    "results" : [ {
      "repo" : "snapshot-local",
      "path" : "foo/42",
      "name" : "a.out",
      "type" : "file",
      "size" : 123456789,
      "created" : "2018-07-05T12:34:56.789+09:00",
      "created_by" : "jenkins",
      "modified" : "2018-07-05T12:34:56.789+09:00",
      "modified_by" : "jenkins",
      "updated" : "2018-07-05T12:34:56.789+09:00",
      "artifacts" : [ {
        "modules" : [ {
          "builds" : [ {
            "build.number" : "42"
          } ]
        } ]
      } ]
    },
    [SNIP]
    }
     ],
    "range" : {
      "start_pos" : 0,
      "end_pos" : 30,
      "total" : 30
    }
    }
    

    I can then parse this to extract build.number.

提交回复
热议问题