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

Enhanced resolve image config #3007

Closed
wants to merge 2 commits into from

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Aug 8, 2022

This implements the first option from #2944 🎉

We extend ResolveImageConfigResponse to include a Manifest and an Index, while leaving the previous fields unchanged.

message ResolveImageConfigResponse {
	string Digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
	bytes Config = 2;
	bytes Manifest = 3;
	bytes Index = 4;
}

Note

Digest may point to Manifest.Digest or Index.Digest or neither if schema1 is used - changing this behavior would be a backwards-incompatible change, and so is out-of-scope for this PR.

With this PR, we should be able to move the image resolution logic out of buildx imagetools, and into buildkit, which will allow respecting registry settings.

dt, err := content.ReadBlob(ctx, cache, config)
if err != nil {
return "", nil, err
// NOTE: most of this logic is butchered from containerd's images.Manifest,
Copy link
Member Author

Choose a reason for hiding this comment

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

The large diff is mostly a result of this change ^

Importing this logic from images.Manifest is really not great, however, the API it provides is not usable to provide the raw []byte content of the manifest. I can't find an alternative, but maybe someone more familiar with the containerd API might know?

Signed-off-by: Justin Chadwell <me@jedevc.com>
Along with the response, as well as returning the digest of the root
image object and the image configuration, we now additionally return the
contents of the manifest and the index (if available).

Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc force-pushed the enhanced-resolve-image-config branch from aed30b5 to a76a8f1 Compare August 8, 2022 12:03
@@ -90,6 +90,8 @@ message ResolveImageConfigRequest {
message ResolveImageConfigResponse {
string Digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
bytes Config = 2;
bytes Manifest = 3;
Copy link
Member

Choose a reason for hiding this comment

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

Having these 2 levels of indirection in here doesn't really cover all the cases. There could be nested indexes, and in attestations PR you are adding descriptors for the attestation manifests etc that can't be accessed(and therefore copied by imagetools) with this method.

I wonder if instead we should just always return the root manifest(the one that digest is pointing to). Client can parse it and make more specific digest results next to resolve the internal objects. This would make Config value optional so maybe there should be a flag in request side that controls if empty config should be an error or not.

@tonistiigi
Copy link
Member

This has been made more flexible in #4563 and can be attempted again. I think my previous comment #3007 (review) still holds.

Closing for now.

@tonistiigi tonistiigi closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants