列出 JFrog Artifactory 上存储库中的所有工件

2024-06-21

我是 Artifactory 的新手。目前我正在开发一个项目来列出存储库中的所有工件。

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、war-dev、war-release、webapp、webapp-dev 中的工件(从 Artifactory 数据库和 http 请求获取存储库列表)。

尝试匿名使用 REST 调用列出工件,但没有登录$ARTIFACTORY_HOME/logs/request_trace.log $ARTIFACTORY_HOME/logs/request.log

从 artdb(Artifactory 数据库)和artifactory url 获取存储库列表。列出的回购协议彼此不同。哪一个是正确的?

列出了这么多的回购协议

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

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

有人可以帮忙找出存储库中的工件列表吗?谢谢你!


AQL 是必经之路。你的查询是almost很好(你忘了$match对于所有以war or web。问题是卷曲。如果你想在命令行中写入查询字符串,你需要转义所有内部" and $。这是工作查询:

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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

列出 JFrog Artifactory 上存储库中的所有工件 的相关文章

随机推荐