curl - 列出 JFrog Artifactory 上存储库中的所有 Artifactory

标签 curl artifactory

我是 Artifactory 的新手。目前我正在开发一个项目来列出存储库中的所有 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 (从 Artifactory 数据库和 http 请求获取存储库列表)。

尝试使用 REST 匿名调用列出 Artifactory ,但 $ARTIFACTORY_HOME/logs/request_trace.log $ARTIFACTORY_HOME/logs/request.log 中没有日志

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

列出了很多存储库

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

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

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

最佳答案

AQL 是正确的选择。您的查询几乎很好(您忘记了所有以warweb开头的存储库的$match。问题是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)"

现在,这就是 hell 。相反,请考虑将查询写入文本文件并使用 -d @filename.aql 传递。在这种情况下,您不需要所有转义,查询将如下所示:

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

关于curl - 列出 JFrog Artifactory 上存储库中的所有 Artifactory ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36345068/

相关文章:

java HttpsURLConnection

php - 通过 php (curl) 访问 web 服务 ssl 失败 - ClientSoap

android - 私有(private) Maven 存储库中的多模块 android 项目

javascript - Artifactory:有没有办法在 Artifactory Pro 中自定义 GUI

authentication - 使用带有 Kerberos 的 cURL 在 Keycloak 上进行身份验证

python - 将 Curl "-I --user"转换为 Python 请求

maven-2 - 需要演示 Material 来说服客户使用 Maven

maven-2 - 将 Artifactory 中的 Artifactory 复制到远程存储库

ios - Alamofire自定义参数

jenkins 回滚以前的部署版本