我是Artifactory的新手。目前,我正在一个项目中列出存储库中的所有工件。
人工版本:4.1.3 Pro(关闭了证书验证)
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请求中获取仓库清单)。
试图匿名使用REST调用列出工件,但是没有登录 $ARTIFACTORY_HOME/logs/request_trace.log $ARTIFACTORY_HOME/logs/request.log
从artdb(Artifactory数据库)和工件URL中获取仓库清单。列出的存储库彼此不同。哪一个是正确的?
列出了这么多的回购
mysql> select distinct(repo) from nodes;
| war |
| war-dev |
| war-release |
https://artifactory.xxxx.com/artifactory/repo/
webapp/
webapp-dev/
有人可以帮忙找出回购清单中的工件清单吗?谢谢!
AQL是必经之路。而且您的查询几乎是不错的(您$match
以war
or开头的所有存储库都忘记了web
。问题是curl。如果要在命令行中编写查询字符串,则需要转义所有内部"
和$
。这是工作查询:
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
。在这种情况下,您不需要所有转义,查询将如下所示:
items.find({
"type" : "file",
"$or":[{
"repo" : {"$match" : "war*"},
"repo" : {"$match" : "web*"} }]})
.include("name","repo","path","size")
.sort({"$desc": ["size"]})
.limit(10)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句