-
Notifications
You must be signed in to change notification settings - Fork 99
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
OCI Store resolver returns plain descriptor #457
Comments
Returning the complete descriptor could be tricky in some scenarios. I would like to take the chance to discuss this use case: {
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "v1.0",
"foo":"bar"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "latest",
"foo":"bar"
}
}
]
} If we resolve the descriptor by its digest: desc, err := oci.Resolve(ctx, "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f") What should be the result of Should it be the descriptor tagged by {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "v1.0",
"foo":"bar"
}
}, Or the descriptor tagged by {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "latest",
"foo":"bar"
}
} Or should we strip the annotation {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"foo":"bar"
}
} |
Hi @Wwwsylvia, Ideally all annotations should be kept and the resolver should return an array of descriptors for the requested digest. To keep things simple it might make sense to strip the |
@Wwwsylvia it is my understanding that in the current OCI model, it is a legal and common case that a |
@gertd Yes a digest can be associated with multiple tags, and all the tags are saved in
Do you mean we should return a list of descriptors for
Could you elaborate a bit more on "backward compatibility"? |
Maybe we can add a function func (s *Store) ResolveN(ctx context.Context, reference string) ([]ocispec.Descriptor, error) Using the above example, if we call descs, err := oci.ResolveN(ctx, "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f") The result would be [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "v1.0",
"foo":"bar"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "latest",
"foo":"bar"
}
}
] And if we call descs, err := oci.ResolveN(ctx, "latest") The result would be [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"org.opencontainers.image.ref.name": "latest",
"foo":"bar"
}
}
] |
For the original Code: desc, err := oci.Resolve(ctx, "latest") Result: {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"foo":"bar",
"org.opencontainers.image.ref.name": "latest",
}
} Code: desc, err := oci.Resolve(ctx, "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f") Result: {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 7143,
"digest": "sha256:e692418e4cbaf90ca69d05a66403747baa33ee08806650b51fab815ad7fc331f",
"annotations": {
"foo":"bar",
}
} |
@shizhMSFT What do you think? |
My suggestion would be
|
Based on discussion on #457, this PR returns a full descriptor on Resolve when the method it's called by tag and it returns a plain descriptor when the method it's called by digest. Signed-off-by: oanatmaria <oana@aserto.com>
This is a breaking change which introduces inconsistent behavior of resolver between remote and OCI store. |
@qweeah Could you elaborate a bit on this? |
Well remote registry manifest resolver always returns a descriptor without annotation. oras-go/registry/remote/repository.go Lines 1372 to 1376 in e8225cb
With merging of e8225cb, resolve a manifest via tag from OCI layout will always get a descriptor with at least one Noticed this because of the E2E failure in ORAS CLI:
The content doesn't match so the spec fails. |
This might not be a critical change since oras-go doesn't make any promise to guarantee that the resolved descriptor from registry and OCI layout will be identical. But IMHO it's better to bring it to up for discussion, like whether it's a breaking change and shall we pick it out from upcoming V2 minor releases. |
Yeah there is no a guarantee that
I personally don't think it's a breaking change for @shizhMSFT Any thoughts? |
In general, If ORAS CLI E2E tests has more context on the |
Closed by #468 |
The |
When resolving a descriptor from the OCI store, the returned descriptor is stripped down to contain only the media type, digest and size:
oras-go/content/oci/oci.go
Line 185 in 96a37c2
Is there any particular reason to not have a complete descriptor returned ?
The text was updated successfully, but these errors were encountered: