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

Merging artifacts Branch: Add discover comand #419

Merged
merged 32 commits into from
Jul 1, 2022

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Jun 27, 2022

This PR adds a new discover command, which can be used for searching referrer artifacts.

Resolves #382, related to #379

qweeah and others added 7 commits June 27, 2022 11:43
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
@qweeah qweeah changed the title Add discover comand Merging Artifact Branch: Add discover comand Jun 28, 2022
@qweeah qweeah changed the title Merging Artifact Branch: Add discover comand Merging artifacts Branch: Add discover comand Jun 28, 2022
qweeah and others added 12 commits June 28, 2022 15:43
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <qweeah@gmail.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
…nto artifacts-discover

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/discover.go Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah requested a review from shizhMSFT June 30, 2022 05:55
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
@Wwwsylvia
Copy link
Member

Can we put a screenshot of the command demo in the comment?

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah
Copy link
Contributor Author

qweeah commented Jun 30, 2022

Can we put a screenshot of the command demo in the comment?

@Wwwsylvia Suppose we have

localhost:5000/net-monitor:v1
├── signature/example
│   └── sha256:f7a4c823ef97b046dd219bd78952f47e3794172650570d524953f8033670e0f2
│       └── signature/example
│           └── sha256:3516a004b42f1dce8902a16f97e5c88e9fa4992066815b45037dc28b1fdf7740
└── sbom/example
    └── sha256:ec564f5a4c71941928766f8d3e7c429063afcbc308a3dd1aa59bca147008408d
        └── signature/example
            └── sha256:7aed904b970f3fe9776a60cd047dc0b9c0efe20d65c242b8ac5625a95fc8ae81
  • oras discover localhost:5000/net-monitor:v1 -o json will show
{
  "referrers": [
    {
      "digest": "sha256:f7a4c823ef97b046dd219bd78952f47e3794172650570d524953f8033670e0f2",
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "signature/example",
      "size": 411
    },
    {
      "digest": "sha256:ec564f5a4c71941928766f8d3e7c429063afcbc308a3dd1aa59bca147008408d",
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "sbom/example",
      "size": 401
    }
  ]
}
  • oras discover localhost:5000/net-monitor:v1 will show
Discovered 2 artifacts referencing localhost:5000/net-monitor:v1
Digest: sha256:c33272f6cb9bd31fffed825757c9693ea19cb01a958a11ebb0fce86972f8ff0c

Artifact Type       Digest
signature/example   sha256:f7a4c823ef97b046dd219bd78952f47e3794172650570d524953f8033670e0f2
sbom/example        sha256:ec564f5a4c71941928766f8d3e7c429063afcbc308a3dd1aa59bca147008408d
  • oras discover localhost:5000/net-monitor:v1 --artifact-type signature/example will show
localhost:5000/net-monitor:v1
└── signature/example
    └── sha256:f7a4c823ef97b046dd219bd78952f47e3794172650570d524953f8033670e0f2
        └── signature/example
            └── sha256:3516a004b42f1dce8902a16f97e5c88e9fa4992066815b45037dc28b1fdf7740
  • oras discover localhost:5000/net-monitor:v1 --artifact-type sbom/example will show
localhost:5000/net-monitor:v1
└── sbom/example
    └── sha256:ec564f5a4c71941928766f8d3e7c429063afcbc308a3dd1aa59bca147008408d

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
`,
Args: cobra.ExactArgs(1),
PreRun: func(cmd *cobra.Command, args []string) {
fmt.Println("Command discover is in preview and might have breaking changes coming.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's review the UX offline tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added latest tag a default:

  • Tree
Using default tag: latest
localhost:5000/net-monitor:latest
├── signature/example
│   └── sha256:2437d8720c28d2bd2ad830d218ebb47942c099e21ff9cf9abbeb5e396203f6dd
│       └── signature/example
│           └── sha256:7c8fa4053dd322a3c1ea069a43c2cfba90ef4db4c9fed71f10da9d3a2071479c
└── sbom/example
    └── sha256:4b6726d63d4283fa579ddf29c4b0838025e2e27e5856e25db78fb50387461ee3
        └── signature/example
            └── sha256:673048d3beb0fada31b268b0e56a89c49fd6c0d2ec9b5ba63330e712b0c6758f
  • Table
Using default tag: latest
Discovered 2 artifacts referencing localhost:5000/net-monitor:latest
Digest: sha256:4d5dd672805a7e20d19d1ae89bf4c5d371c47a018cb33bbc4dec989444602bd0

Artifact Type       Digest
signature/example   sha256:2437d8720c28d2bd2ad830d218ebb47942c099e21ff9cf9abbeb5e396203f6dd
sbom/example        sha256:4b6726d63d4283fa579ddf29c4b0838025e2e27e5856e25db78fb50387461ee3
  • JSON
Using default tag: latest
{
  "referrers": [
    {
      "digest": "sha256:2437d8720c28d2bd2ad830d218ebb47942c099e21ff9cf9abbeb5e396203f6dd",
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "signature/example",
      "size": 411
    },
    {
      "digest": "sha256:4b6726d63d4283fa579ddf29c4b0838025e2e27e5856e25db78fb50387461ee3",
      "mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json",
      "artifactType": "sbom/example",
      "size": 401
    }
  ]
}

cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
cmd/oras/discover.go Outdated Show resolved Hide resolved
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit 9b55e71 into oras-project:main Jul 1, 2022
qweeah added a commit to qweeah/oras that referenced this pull request Jul 4, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
qweeah added a commit to qweeah/oras that referenced this pull request Jul 7, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
qweeah added a commit to qweeah/oras that referenced this pull request Jul 7, 2022
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
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

Successfully merging this pull request may close these issues.

Discover sub-command is not using the latest ORAS Manifest Referrers API spec
3 participants