Skip to content

ctr export strictly matching#7615

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
turan18:export-bug
Nov 2, 2022
Merged

ctr export strictly matching#7615
dmcgowan merged 1 commit intocontainerd:mainfrom
turan18:export-bug

Conversation

@turan18
Copy link
Copy Markdown
Contributor

@turan18 turan18 commented Nov 1, 2022

When attempting to export an image without providing a specific platform(s)( eg: ctr i export <output.tar> <image_ref>) , ctr returns an error: ctr: content digest sha256:<hash>: not found . ctr exports default matcher platforms.Default() , uses the Only() match comparer which matches for a single platform and all its variants (IE linux/amd64 and linux/386). The index/manifest list that is pulled when using ctr i pull <image_ref>( without providing --all-platforms or --platform options) only pulls the platform that is relevant to the users machine(eg: only linux/amd64). Although the manifest contains references to different platforms only the default(host machines platform) content is pulled. The export function matches loosely against the different platformed manifests and as a result fails when attempting to retrieve manifest content that does not exist (eg: for an amd/64 machine the manifest for 386 does not exist for an image pulled, at least, without specifying it explicitly when pulling/using the all platforms option).

This commit changes the behavior to adopt strictly matching platform using platforms.DefaultStrict() which would match only with a single type of a platform (eg: only amd/64) using the OnlyStrict() match comparer when exporting without the --platform or --all-platform options. This change is similar to that introduced in this PR- #6906 which addresses a similar bug for ctr import - #6441.

Fixes: #5895

Signed-off-by: Yasin Turan [email protected]

@k8s-ci-robot
Copy link
Copy Markdown

Hi @turan18. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@austinvazquez
Copy link
Copy Markdown
Member

Fixes #6812?

@turan18
Copy link
Copy Markdown
Contributor Author

turan18 commented Nov 1, 2022

Fixes #6812?

No. This commit addresses purely exporting images that are not generated via a checkpoint. I don't believe exporting checkpoint images is currently supported.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan merged commit 49f96d8 into containerd:main Nov 2, 2022
@thaJeztah thaJeztah added cherry-picked/1.5.x PR commits are cherry-picked into release/1.5 branch cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch and removed cherry-pick/1.6.x labels Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.5.x PR commits are cherry-picked into release/1.5 branch cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctr images export doesn't work

6 participants