Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define human output for oras discover #255

Closed
SteveLasker opened this issue Apr 4, 2021 · 4 comments
Closed

Define human output for oras discover #255

SteveLasker opened this issue Apr 4, 2021 · 4 comments
Assignees

Comments

@SteveLasker
Copy link
Contributor

The new oci.artifact.manifest support add discover, to find the list of referenced artifacts.

The question is what should the default, human, output be:

Today:

  • default output
oras discover localhost:5000/hello-world:latest
Discovered 2 artifacts referencing localhost:5000/hello-world:latest
Digest: sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792
Reference: sha256:f4232599e2d5246ec1f4dc419bacd5510a02c2f0e3c98b800f38c8cbbd61550d
Reference: sha256:fa31146981940964ced259bd2edd36c10277207e3be4d161bdb96e5e418fc2e0
  • -v output
oras discover -v localhost:5000/hello-world:latest
Discovered 2 artifacts referencing localhost:5000/hello-world:latest
Digest: sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792
Reference: sha256:f4232599e2d5246ec1f4dc419bacd5510a02c2f0e3c98b800f38c8cbbd61550d
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.artifact.manifest.v1+json",
  "artifactType": "application/vnd.cncf.notary.v2",
  "blobs": [
    {
      "mediaType": "application/tar",
      "digest": "sha256:204e7c423c891d0e4b057c4ecb068a53ffc991ef5a3bb47467f1b8088775dc48",
      "size": 84,
    }
  ],
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
      "size": 525
    }
  ]
}
Reference: sha256:fa31146981940964ced259bd2edd36c10277207e3be4d161bdb96e5e418fc2e0
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.artifact.manifest.v1+json",
  "artifactType": "application/x.example.sbom.v0",
  "blobs": [
    {
      "mediaType": "application/tar",
      "digest": "sha256:204e7c423c891d0e4b057c4ecb068a53ffc991ef5a3bb47467f1b8088775dc48",
      "size": 84,
    }
  ],
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
      "size": 525
    }
  ]
}
  • --output-json output
oras discover --output-json localhost:5000/hello-world:latest
{
  "digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
  "links": [
    {
      "digest": "sha256:f4232599e2d5246ec1f4dc419bacd5510a02c2f0e3c98b800f38c8cbbd61550d",
      "manifest": {
        "schemaVersion": 2,
        "mediaType": "application/vnd.oci.artifact.manifest.v1+json",
        "artifactType": "application/vnd.cncf.notary.v2",
        "blobs": [
          {
            "mediaType": "application/tar",
            "digest": "sha256:204e7c423c891d0e4b057c4ecb068a53ffc991ef5a3bb47467f1b8088775dc48",
            "size": 84,
          }
        ],
        "manifests": [
          {
            "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
            "size": 525
          }
        ]
      }
    },
    {
      "digest": "sha256:fa31146981940964ced259bd2edd36c10277207e3be4d161bdb96e5e418fc2e0",
      "manifest": {
        "schemaVersion": 2,
        "mediaType": "application/vnd.oci.artifact.manifest.v1+json",
        "artifactType": "application/x.example.sbom.v0",
        "blobs": [
          {
            "mediaType": "application/tar",
            "digest": "sha256:204e7c423c891d0e4b057c4ecb068a53ffc991ef5a3bb47467f1b8088775dc48",
            "size": 84
          }
        ],
        "manifests": [
          {
            "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "digest": "sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
            "size": 525
          }
        ]
      }
    }
  ]
}

The --output-json looks good, as it matches the /references API
But, what should the default output be?

Seems we need:

  1. tag and digest of the target artifact. Including the digest of the target object enables an easy way to get the digest of the current artifact, for newly pushed artifacts, using the digest as the --artifact-reference
  2. number of references found

Proposal:

Discover references to:

reference digest
localhost:5000/hello-world:latest sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792

Discovered 2 references:

aritfactType digest
application/vnd.cncf.notary.v2 sha256:f4232599e2d5246ec1f4dc419bacd5510a02c2f0e3c98b800f38c8cbbd61550d
application/x.example.sbom.v0 sha256:fa31146981940964ced259bd2edd36c10277207e3be4d161bdb96e5e418fc2e0
@shizhMSFT
Copy link
Contributor

shizhMSFT commented Apr 6, 2021

@SteveLasker It is getting more and more like https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli.
See JSON output format and Table output format.

@SteveLasker
Copy link
Contributor Author

it is getting more and more like https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli.

Is that a bad thing? :)

@shizhMSFT
Copy link
Contributor

shizhMSFT commented Apr 8, 2021

@SteveLasker How about this? (commit 6f764bf)

$ oras discover localhost:5000/test:latest
Discovered 5 artifacts referencing localhost:5000/test:latest
Digest: sha256:c38fe4b80a6c5c23b211365408bdb8deeda5132cd802c988fb4cd0b972ccfb9f

Artifact Type                    Digest
fun.artifact                     sha256:dbc5de82f3919565d9b1a08400a4ea6ff932e6c31a4973b9450f1053e192b521
application/vnd.cncf.notary.v2   sha256:588ad0757792c174e2c10c99f5914f06608e3391ce95cfbfaaabe6eec02c9c41
application/vnd.cncf.notary.v2   sha256:ad9aa1a57753bfe40137af1d82c19597634bc74145f9315272c8fb6b947a3fe2
application/vnd.cncf.notary.v2   sha256:b0abe4cc7cdfa64f525e54cbcf599b7c8700f8c70caa5fc94cea23bc7fd8e1ae
application/vnd.cncf.notary.v2   sha256:bd703577dbcf5c6f03c631902b76cab353aa1ae1ee37c1133406ca4b6f340025

@SteveLasker
Copy link
Contributor Author

Closing as #258 and the -o commands have been completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants