oras icon indicating copy to clipboard operation
oras copied to clipboard

oras discover doesn't return the full digest

Open SteveLasker opened this issue 3 years ago • 1 comments

Repro Steps

Follow steps from: https://github.com/oras-project/artifacts-spec/blob/main/docs/quick-start.md

At the oras discover step, note the output is:

oras discover $PUBLIC_IMAGE -o json | jq
{
  "digest": "sha256:a0fc570a245b09ed752c42d600ee3bb5b4f77bbd70d8898780b7ab43454530eb",
  "references": [
    {
      "digest": "sha256:6200e3cfb0a036bdc585f99cee2ace9926f327d586fef8241f16e510fa2b0734",
      "artifactType": "org.cncf.notary.v2"
    }
  ]
}

Curling the /referrers/ API generates:

curl $PRIVATE_REGISTRY/oras/artifacts/v1/net-monitor/manifests/$DIGEST/referrers | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   413  100   413    0     0   201k      0 --:--:-- --:--:-- --:--:--  201k
{
  "references": [
    {
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "org.cncf.notary.v2",
      "digest": "sha256:dbbd7afa8defcd81594365d3a421d7b61aaade559e8dd53b6481b0146a9f38fb",
      "size": 477
    },
    {
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "org.cncf.notary.v2",
      "digest": "sha256:ffbd4516835619c35be35c9bd55a06cfb36b254222e42789273d1ab4c6bc635a",
      "size": 477
    }
  ]
}

Expected

The tree and table outout formats should limit to the digest and artifactType. However, the -o json should be consistent with the referrers API to enable nested commands.

oras discover $PUBLIC_IMAGE -o json | jq
{
  "references": [
    {
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "org.cncf.notary.v2",
      "digest": "sha256:dbbd7afa8defcd81594365d3a421d7b61aaade559e8dd53b6481b0146a9f38fb",
      "size": 477
    },
    {
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "org.cncf.notary.v2",
      "digest": "sha256:ffbd4516835619c35be35c9bd55a06cfb36b254222e42789273d1ab4c6bc635a",
      "size": 477
    }
  ]
}

SteveLasker avatar Sep 27 '21 23:09 SteveLasker

I don't see the need for client APIs to mimic rest. But I do see the value in adding other fields from the descriptor into the ORAS output.

Currently discover also shows the digest of the queried artifact. I don't think we should remove that since the reference API doesn't have that in its payload.

Oras has the option of modifying the output to add this without affecting the original references API and if its RAW APIs that helps then we should just use a rest client rather than trying to use the ORAS client to show the API.

For e.g. docker manifest inspect outputs a pretty manifest and not the raw form. If you want the raw form you query the API directly. You don't see the digest or other headers in the call.

sajayantony avatar Oct 11 '21 18:10 sajayantony

Closing this as the json output now is an OCI index and contains referrer digest.

qweeah avatar Feb 27 '23 01:02 qweeah