1

I am trying to fetch the SHA_256 value from manifest.json file but unable to get using aql.

Below is the cmd I am using:

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" : [ ]
},{

However, if you look the original manifest.json file from UI.It contains SHA256 value.

enter image description here

TylerH
  • 20,799
  • 66
  • 75
  • 101
dell xps
  • 41
  • 5

1 Answers1

1

According to the AQL documentation, the item entity has the sha256 field. But it mentions the following note:

SHA-256 is supported from Artifactory version 5.5

You can only do an AQL search on an Artifact that has been deployed to Artifactory version 5.5 or above, or if you have migrated your database as described in SHA-256 Support after upgrading Artifactory to version 5.5 and above.

Please verify your Artifactory fits the requirements above.

In addition, assuming this is a Docker manifest.json, it specifically should also have the SHA256 in a property named docker.manifest.digest (and maybe also a property named sha256). To get the property values you can add "property.*" to the include(..) part of the query.

For example:

items.find({"repo":"xyz","path":"a/b/c","name":"manifest.json"})
     .include("repo","path","name","sha256","property.*")

Will return something like:

{
"results" : [ {
  "repo" : "xyz",
  "path" : "a/b/c",
  "name" : "manifest.json",
  "sha256" : "34cb6f8e1e1aca...",
  "properties" : [ {
    "key" : "docker.manifest.digest",
    "value" : "sha256:34cb6f8e1e1aca..."
  },{
    "key" : "sha256",
    "value" : "34cb6f8e1e1aca..."
  }
  ...
yinon
  • 1,418
  • 11
  • 14
  • I am running the artifactory version 7.17.4 rev. yes the docker manifest file contains the sha-256 but while running the above cmd ...sha256 is not getting listed.I have attached the image above when you click on enter image description and yes this is docker image – dell xps Jan 27 '22 at 10:14
  • Edited my answer to add an example. – yinon Jan 27 '22 at 10:52