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

feat: Image / Index by Matcher #88

Merged
merged 1 commit into from
Oct 1, 2024
Merged

feat: Image / Index by Matcher #88

merged 1 commit into from
Oct 1, 2024

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Sep 27, 2024

Allow an Image or ImageIndex to be retrieved from a SIF file by Matcher - e.g. match.Name(..) to match by ref.name annotation.

Fixes #82

@dtrudg dtrudg force-pushed the issue-82 branch 5 times, most recently from 99f8a1f to 376ac47 Compare September 30, 2024 11:54
@dtrudg dtrudg changed the title feat: feat: Image / Index by name.Reference feat: Image / Index by name.Reference Sep 30, 2024
@dtrudg dtrudg marked this pull request as ready for review September 30, 2024 17:01
Copy link
Member

@tri-adam tri-adam left a comment

Choose a reason for hiding this comment

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

Should we support retrieving images/indexes by properties other than the org.opencontainers.image.ref.name annotation?

A few potential use cases I can foresee:

  1. Retrieve by digest. The current API supports this by supplying a name.Digest, but this attempts to match the org.opencontainers.image.ref.name annotation rather than the digest in the descriptor?
  2. Retrieve an image from a multi-arch index. If I have a root index that points to a multi-arch index, should I be able to retrieve an image by supplying the reference (of the index) and the platform (of the image)?
  3. Retrieve by artifact type. For example, in a SIF with an OCI artifact and then other artifacts that reference it, I might want to retrieve the "base" artifact by its type?

pkg/sif/image.go Outdated Show resolved Hide resolved
pkg/sif/index.go Outdated Show resolved Hide resolved
@dtrudg
Copy link
Member Author

dtrudg commented Oct 1, 2024

Should we support retrieving images/indexes by properties other than the org.opencontainers.image.ref.name annotation?

A few potential use cases I can foresee:

1. Retrieve by digest. The current API supports this by supplying a `name.Digest`, but this attempts to match the `org.opencontainers.image.ref.name` annotation rather than the digest in the descriptor?

2. Retrieve an image from a multi-arch index. If I have a root index that points to a multi-arch index, should I be able to retrieve an image by supplying the reference (of the index) and the platform (of the image)?

3. Retrieve by artifact type. For example, in a SIF with an OCI artifact and then other artifacts that reference it, I might want to retrieve the "base" artifact by its type?

Rewritten so the functions take the match.Matcher directly - which should allow 1, 2 directly with match.Digests / match.Platform. 3 should be possible with a custom matcher, which we could provide in oci-tools at a later date?

Look okay to you?

@dtrudg dtrudg changed the title feat: Image / Index by name.Reference feat: Image / Index by Matcher Oct 1, 2024
@dtrudg dtrudg requested a review from tri-adam October 1, 2024 08:48
@dtrudg
Copy link
Member Author

dtrudg commented Oct 1, 2024

Should we support retrieving images/indexes by properties other than the org.opencontainers.image.ref.name annotation?
A few potential use cases I can foresee:

1. Retrieve by digest. The current API supports this by supplying a `name.Digest`, but this attempts to match the `org.opencontainers.image.ref.name` annotation rather than the digest in the descriptor?

2. Retrieve an image from a multi-arch index. If I have a root index that points to a multi-arch index, should I be able to retrieve an image by supplying the reference (of the index) and the platform (of the image)?

3. Retrieve by artifact type. For example, in a SIF with an OCI artifact and then other artifacts that reference it, I might want to retrieve the "base" artifact by its type?

Rewritten so the functions take the match.Matcher directly - which should allow 1, 2 directly with match.Digests / match.Platform. 3 should be possible with a custom matcher, which we could provide in oci-tools at a later date?

Look okay to you?

Ahh sorry - yeah 2. is nested index so this doesn't work directly, as you pointed out in Slack.

@tri-adam
Copy link
Member

tri-adam commented Oct 1, 2024

Alright, as discussed in huddle... let's take a match.Matcher (to select the top level manifest) and then functional options (as a placeholder for future logic that operates on the selected manifest, for example a platforms flag.)

Allow an Image or ImageIndex to be retrieved from a SIF file by
Matcher - e.g. match.Name(..) to match by ref.name annotation.

Fixes sylabs#82
@dtrudg dtrudg merged commit c60f7a6 into sylabs:main Oct 1, 2024
10 checks passed
@dtrudg dtrudg deleted the issue-82 branch October 1, 2024 16:06
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.

Retrieve Image / ImageIndex by name / tag annotation
2 participants