通过 Artifactory API 列出给定包的所有资产的最佳方式是什么?
我正在尝试编写一个脚本来获取包的资产,并且我希望它可以与多种存储库类型一起使用,例如 Maven 和 PyPI。我知道我可以使用文件夹信息 API 来获得我需要的东西,但这依赖于存储库布局,因此它不适用于跨存储库类型。
我目前正在使用此 AQL 搜索:
curl -u user:password -X POST http://<artifactory_url>/artifactory/api/search/aql \
-H "Content-Type: text/plain" \
-d 'items.find({"repo": "libs-release-local"}, {"artifact.module.name": "com.foo.bar:fizz-buzz:1.2"})'
响应几乎是我想要的,但它似乎包括来自我正在搜索的不同版本的包的一些资产:
{
"results" : [ {
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.0",
"name" : "fizz-buzz-1.0.properties",
"type" : "file",
"size" : 790,
"created" : "2020-09-29T15:35:59.233Z",
"created_by" : "user",
"modified" : "2020-09-29T15:35:59.181Z",
"modified_by" : "user",
"updated" : "2020-09-29T15:35:59.233Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.1",
"name" : "fizz-buzz-1.1.properties",
"type" : "file",
"size" : 790,
"created" : "2020-09-29T15:42:34.982Z",
"created_by" : "user",
"modified" : "2020-09-29T15:42:34.931Z",
"modified_by" : "user",
"updated" : "2020-09-29T15:42:34.983Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2-javadoc.jar",
"type" : "file",
"size" : 391843,
"created" : "2020-09-30T18:54:41.599Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:40.650Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:41.600Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2-sources.jar",
"type" : "file",
"size" : 1089,
"created" : "2020-09-30T18:54:41.764Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:41.710Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:41.765Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2.jar",
"type" : "file",
"size" : 1410,
"created" : "2020-09-30T18:54:41.902Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:41.844Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:41.903Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2.module",
"type" : "file",
"size" : 3481,
"created" : "2020-09-30T18:54:42.015Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:41.962Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:42.015Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2.pom",
"type" : "file",
"size" : 781,
"created" : "2020-09-30T18:54:42.238Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:42.190Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:42.238Z"
},{
"repo" : "libs-release-local",
"path" : "com/foo/bar/fizz-buzz/1.2",
"name" : "fizz-buzz-1.2.properties",
"type" : "file",
"size" : 790,
"created" : "2020-09-30T18:54:42.124Z",
"created_by" : "user",
"modified" : "2020-09-30T18:54:42.078Z",
"modified_by" : "user",
"updated" : "2020-09-30T18:54:42.125Z"
} ],
"range" : {
"start_pos" : 0,
"end_pos" : 8,
"total" : 8
}
}
请注意它是如何包含 fizz-buzz 1.0 和 1.1 的属性文件的,即使我在搜索中指定了 1.2。
有没有更好的方法来获取我正在寻找的信息?