Artifactory AQL download artifact

℡╲_俬逩灬. 提交于 2019-12-04 16:44:58

An easy way to use your aql script to download files from artifactory is to use the JFrog cli as mention here : https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-Download,CopyandMoveCommandsSpecSchema

The cli can be downloaded as an executable for linux, mac or windows and should fit your needs

With the curl command the only thing you can do is then to parse the result from your aql query and perform download request for each file.

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,
  }
  ]
}
redusek

jfrog cli supports --limit, --sort-order, and --sort-by arguments.

The following works for me:

jfrog rt search --spec=/tmp/jfrogfilespec.json --sort-by created --sort-order=desc --limit 1 

The contents of the json spec file are:

{ "files": [ { "aql": { "items.find": { "repo":{"$eq":"my-release-repo"}, "name":{"$match":"my-artifact-prefix*"} } } } ] }

This generates the following query (according to debug mode):

items.find( { "repo":{"$eq":"my-release-repo"}, "name":{"$match":"my-artifact-prefix*"} } ).include("name","repo","path","actual_md5","actual_sha1","size","type","created").sort({"$desc":["created"]}).limit(1)

What is frustrating is that I cannot seem to find a way to use "jfrog rt search" with a filespec that allows me to influence the "include" modifier portion of the search.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!