Artifactory AQL下载工件 [英] Artifactory AQL download artifact

查看:158
本文介绍了Artifactory AQL下载工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用AQL下载工件?

Is there a way to download an artifact using AQL?

我发送了一个查询:

curl -u user:pass \
-X POST https://artifactoryURL/artifactory/api/search/aql \
-H 'content-type: text/plain' \
-T query.aql

还有我的query.aql:

items.find(
    {
        "repo":{"$eq":"repo"},
        "$and": [
          {
            "path": { "$match": "path/*"},
            "name": { "$match": "*.rpm"}
          }
        ]
    }
)
.sort({ "$desc": ["modified"] })
.limit(1)

现在我知道它会返回我想要的东西,有没有办法将请求从api/search/aql更改为api/download/aql之类的东西并获得这些物品?

Now that I know it returns what I want, Is there a way to change the request from api/search/aql to something like api/download/aql and get those items?

我还尝试过使用 jfrog cli 来执行此操作,但是他们在那里并不完全支持AQL(排序和限制无效).

I had also tried doing this with the jfrog cli but they don't fully support AQL there (sort and limit didn't work).

这是我尝试的命令:

jfrog rt s --spec=query-aql.json

以及未能对结果进行排序和限制的规范:

And the spec that failed to sort and limit results:

{
  "files": [
    {
      "aql": {
        "items.find": {
          "repo": "repo",
          "$and": [
            {
              "path": { "$match": "path/*"},
              "name": { "$match": "*.rpm"}
            }
          ]
        }
      },
      "sort": {
        "$asc": ["modified"]
      },
      "limit": 1
    }
  ]
}

添加了一个jfrog-cli-go问题: https://github. com/JFrogDev/jfrog-cli-go/issues/56

Added a jfrog-cli-go issue: https://github.com/JFrogDev/jfrog-cli-go/issues/56

推荐答案

我只是在寻找一个非常相似的东西-使用下载规范文件从给定的存储库和路径中下载最新的工件.我不在乎是否使用AQL,我只想在download-spec.json文件中使用它.如果您转到链接在上方查看示例5 .

I was just looking for a very similar thing -- use a download spec file to download the latest artifact from a given repo and path. I don't care if I use AQL or not, I just want it in the download-spec.json file. If you go to the link above look at Example 5.

针对您的示例进行了修改:

Modified for your example:

{
  "files": [
  {
    "pattern": "path/*.rpm",
    "target": "my/download/path/",
    "sortBy": "created",
    "sortOrder": "desc",
    "limit": 1,
  }
  ]
}

这篇关于Artifactory AQL下载工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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