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

Fix containerimage multi-platform unpack #3982

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Jun 30, 2023

🛠️ Fix docker/buildx#1813 (comment) (see point 2 in #3891 (comment))
⬆️ Fixes up #3251

cc @vvoland @rumpl

In #3251, we added an overly restrictive check for unpackImage which, while preventing it from unpacking images with no layers, also prevented it from unpacking multi-platform images.

This PR pushes the check further down into unpackImage, so that we can still unpack multi-platform images.

(Maybe also worth a cherry-pick back to the v0.11 branch?)

The original commit (fddd129) that
added this test did so to check that empty layers wouldn't be unpacked
which would cause a nil de-reference.

However, `unpack` wasn't added to the export test, so the test wasn't
actually testing the changed behavior.

Signed-off-by: Justin Chadwell <me@jedevc.com>
fddd129 added an overly broad check for
preventing unpacking scratch objects, which also prevents unpacking any
multi-platform images (which instead use `src.Refs`).

We can push the nil check down into unpackImage, and also use the
`FindRef` result helper to simplify to the Ref(s).

Signed-off-by: Justin Chadwell <me@jedevc.com>
Copy link
Collaborator

@vvoland vvoland left a comment

Choose a reason for hiding this comment

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

Tested in Moby; LGTM!

@tonistiigi tonistiigi merged commit 2c0cf71 into moby:master Jul 6, 2023
54 checks passed
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