【问题标题】:Sorting artifacts using aql and cleanup old artifacts使用 aql 对工件进行排序并清理旧工件
【发布时间】:2022-08-16 22:30:19
【问题描述】:

我正在尝试从 jfrog artifactory 中对工件列表进行排序,但在 jfrog 文档 (https://www.jfrog.com/confluence/display/JFROG/Artifactory+Comparison+Matrix) 中得到(请求的 URL 返回错误:400 Bad Request)说它不适用于开源服务。在我们获得工件列表后,需要从工件存储库的子文件夹中删除旧工件。尝试使用 CLI 和 AQL,但没有任何效果。

我们的 repo url 看起来像这样 http://domainname/artifactory/repo/folder/subfolder/test1.zip

与 test 1.zip 一样,我们在该子文件夹中有许多工件(比如说 50 个)。寻求帮助,任何人都请我解决这个问题。谢谢。

    标签: api sorting artifactory artifactory-query-lang


    【解决方案1】:

    虽然 OSS 版本不支持排序,但如果您想删除某个时间段之前的工件,您可以使用Relative Time Operators,解析输出,然后使用脚本删除这些工件。 您还可以指定specific date。您可以使用几个Comparison Operators。 您可以使用以下 AQL 作为参考:

    curl -uadmin:password -XPOST "http://localhost:8082/artifactory/api/search/aql" -d 'items.find({"repo": "repo"}, {"path": "folder/subfolder"}, {"created" : {"$before" : "2minutes"}})'  -H "Content-Type: text/plain"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 1970-01-01
      • 1970-01-01
      • 2010-11-26
      相关资源
      最近更新 更多