我试图从manifest.json文件中获取SHA_256值,但无法使用aql。
以下是我正在使用的命令:
ubuntu@test:~$ **curl -sS -u sumkumar:$pw -XPOST -k -H "Content-type: text/plain" https://<URL>/artifactory/api/search/aql -d 'items.find({"repo":"xyz"},{"path":"a/b/c"}).include("*")'**
{
"results" : [ {
"repo" : "xyz",
"path" : "a/b/c",
"name" : "manifest.json",
"type" : "file",
"size" : 1579,
"created" : "2018-03-13T11:58:33.771Z",
"created_by" : "uex-sp-cd",
"modified" : "2018-03-15T14:17:38.299Z",
"modified_by" : "uex-sp-cd",
"updated" : "2018-03-15T14:17:38.299Z",
"depth" : 4,
"actual_md5" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"actual_sha1" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"original_md5" : "NO_ORIG",
"original_sha1" : "NO_ORIG",
"virtual_repos" : [ ]
},{
但是,如果您从UI中查看原始manifest.json文件,它包含SHA256值。
在此处输入图像描述
根据AQL文档,item
实体具有sha256
字段。但它提到了以下注意事项:
Artifactory 5.5版支持SHA-256
您只能对已部署到Artifactory 5.5或更高版本的Artifact进行AQL搜索,或者如果您在将Artifactory升级到5.5及更高版本后已按照SHA-256支持中的说明迁移了数据库。
请验证您的工件是否符合上述要求。
此外,假设这是一个Dockermanifest.json
,它还应该在名为docker.manifest.digest
的属性中具有SHA256(也可能是名为sha256
的属性(。要获取属性值,可以将"property.*"
添加到查询的include(..)
部分。
例如:
items.find({"repo":"xyz","path":"a/b/c","name":"manifest.json"})
.include("repo","path","name","sha256","property.*")
将返回类似以下内容:
{
"results" : [ {
"repo" : "xyz",
"path" : "a/b/c",
"name" : "manifest.json",
"sha256" : "34cb6f8e1e1aca...",
"properties" : [ {
"key" : "docker.manifest.digest",
"value" : "sha256:34cb6f8e1e1aca..."
},{
"key" : "sha256",
"value" : "34cb6f8e1e1aca..."
}
...