列出JFrog Artifactory上存储库中的所有工件 [英] list all artifacts in a repository on JFrog Artifactory

查看:269
本文介绍了列出JFrog Artifactory上存储库中的所有工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Artifactory的新手.目前,我正在一个项目中,以列出存储库中的所有工件.

I'm new to the Artifactory. Currently I'm working on a project to list all the artifacts in a repository.

Artifactory版本:4.1.3 Pro(关闭了证书验证)

Artifactory version:4.1.3 Pro (turned off the cert verification)

curl -u uname:password -X POST -k https://artifactory.xxxx.com/artifactory/api/search/aql -d "items.find({"repo":"war"}).include("name","repo","path","size").sort({"$desc":["size"]}).limit(10)"


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /artifactory/api/search/aql was not found on this server.</p>
<hr>
<address>Apache/2.2.31 (Amazon) Server at artifactory.xxxx.com Port 443</address>
</body></html>

抛出错误(错误请求).尝试列出以下仓库,war-dev,war-release,webapp,webapp-dev中的工件(从Artifactory数据库和http请求中获取仓库清单).

It's throwing an error(Bad request). Try to list out the artifacts in the following repos war,war-dev,war-release,webapp,webapp-dev(get the list of repos from Artifactory database and http request).

试图匿名使用REST调用列出工件,但是$ARTIFACTORY_HOME/logs/request_trace.log $ARTIFACTORY_HOME/logs/request.log

Tried to list out the artifacts using REST calls anonymously,But there are no logs in $ARTIFACTORY_HOME/logs/request_trace.log $ARTIFACTORY_HOME/logs/request.log

从artdb(Artifactory数据库)和人工制品URL中获取回购清单.列出的存储库彼此不同.哪个是正确的?

Get the list of repos from artdb(Artifactory database) and artifactory url. listed repos are different from one to other. Which one is correct?

列出了如此多的存储库

mysql> select distinct(repo) from nodes;
| war                               |
| war-dev                           |
| war-release                       |

https://artifactory.xxxx.com/artifactory/repo/
webapp/                                                       
webapp-dev/                                                    

有人可以帮忙找出回购清单中的工件清单吗?谢谢!

Can someone help to find out the list of artifacts in repo Please. Thank you!

推荐答案

AQL是解决之道.而且您的查询几乎是 好(对于以warweb开头的所有存储库,您都忘记了$match.问题是curl.如果要在命令中写入查询字符串您需要转义所有内部"$的行.这是有效的查询:

AQL is the way to go. And your query is almost good (you forgot the $match for all the repos starting with war or web. The problem is curl. If you want to write the query string in the command line you need to escape all the inner " and $. Here's the working query:

curl -u uname:password -X POST -k https://artifactory.xxxx.com/artifactory/api/search/aql -d "items.find({\"type\" : \"file\",\"\$or\":[{\"repo\" : {\"\$match\" : \"war*\"}, \"repo\" : {\"\$match\" : \"web*\"} }]}).include(\"name\",\"repo\",\"path\",\"size\").sort({\"\$desc\": [\"size\"]}).limit(10)"

现在,这是地狱.相反,请考虑将查询写入文本文件,然后将其与-d @filename.aql一起传递.在这种情况下,您不需要所有转义操作,查询将如下所示:

Now, this is hell. Instead, consider writing the query in a text file and passing it with -d @filename.aql. In this case you don't need all the escaping and the query will look like:

items.find({
  "type" : "file",
  "$or":[{
    "repo" : {"$match" : "war*"}, 
    "repo" : {"$match" : "web*"} }]})
  .include("name","repo","path","size")
  .sort({"$desc": ["size"]})
  .limit(10)

这篇关于列出JFrog Artifactory上存储库中的所有工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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