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

create: support images with invalid platform #10739

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Jun 21, 2021

Much to my regret, there is a number of images in the wild with invalid
platforms breaking the platform checks in libimage that want to make
sure that a local image is matching the expected platform.

Imagine a podman run --arch=arm64 fedora with a local amd64 fedora
image. We really shouldn't use the local one in this case and pull down
the arm64 one.

The strict platform checks in libimage in combination with invalid
platforms in images surfaced in Podman being able to pull an image but
failing to look it up in subsequent presence checks. A podman run
would hence pull such an image but fail to create the container.

Support images with invalid platforms by vendoring the latest HEAD from
containers/common. Also remove the partially implemented pull-policy
logic from Podman and let libimage handle that entirely. However,
whenever --arch, --os or --platform are specified, the pull policy will
be forced to "newer". This way, we pessimistically assume that the
local image has an invalid platform and we reach out to the registry.
If there's a newer image (i.e., one with a different digest), we'll pull
it down.

Please note that most of the logic has either already been implemented
in libimage or been moved down which allows for removing some clutter
from Podman.

Fixes: #10682
Signed-off-by: Valentin Rothberg [email protected]

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 21, 2021
@vrothberg
Copy link
Member Author

/hold
Vendoring my fork of c/common for now (containers/common#634).

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 21, 2021
@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from 4d9bfb8 to b2f0f8e Compare June 21, 2021 10:45
@vrothberg
Copy link
Member Author

Also fixes: #10648

@vrothberg vrothberg added the needs-backport Indicates if changes in a PR should be backported to some releases. label Jun 21, 2021
@vrothberg
Copy link
Member Author

Needs a backport to the v3.2 branch.

vrothberg added a commit to vrothberg/common that referenced this pull request Jun 21, 2021
As it turned out in Podman CI (containers/podman/pull/10739), the policy
is overridden via --arch/os/platform/variant even when the policy is set
to never.

While I think this is a bug, it is a separate one and must tackled
separately.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from efc5174 to 940423b Compare June 21, 2021 13:58
vrothberg added a commit to vrothberg/common that referenced this pull request Jun 21, 2021
As it turned out in Podman CI (containers/podman/pull/10739), the policy
is overridden via --arch/os/platform/variant even when the policy is set
to never.

While I think this is a bug, it is a separate one and must tackled
separately.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from 90bb381 to 854e61f Compare June 21, 2021 16:54
@TomSweeneyRedHat
Copy link
Member

Still fighting the good fight with the CI here @vrothberg

@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from af15501 to 71fb632 Compare June 21, 2021 17:13
@vrothberg
Copy link
Member Author

Still fighting the good fight with the CI here @vrothberg

This one really unfolds like origami :^)

@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from cac0320 to 3e9645e Compare June 22, 2021 11:52
@vrothberg
Copy link
Member Author

In case somebody is restarting the jobs, please don't. They look like infra problems but I want to see the errors.

@vrothberg vrothberg closed this Jun 23, 2021
@vrothberg vrothberg reopened this Jun 23, 2021
@vrothberg vrothberg force-pushed the fix-10682 branch 2 times, most recently from 06ec5d9 to 5bcb11b Compare June 23, 2021 09:53
@vrothberg
Copy link
Member Author

Let's see if it's better now. Finally managed to get the logs of a failing int remote test.

Had to massage the remote pulling code a bit and wire the pull policy through.

Much to my regret, there is a number of images in the wild with invalid
platforms breaking the platform checks in libimage that want to make
sure that a local image is matching the expected platform.

Imagine a `podman run --arch=arm64 fedora` with a local amd64 fedora
image.  We really shouldn't use the local one in this case and pull down
the arm64 one.

The strict platform checks in libimage in combination with invalid
platforms in images surfaced in Podman being able to pull an image but
failing to look it up in subsequent presence checks.  A `podman run`
would hence pull such an image but fail to create the container.

Support images with invalid platforms by vendoring the latest HEAD from
containers/common.  Also remove the partially implemented pull-policy
logic from Podman and let libimage handle that entirely.  However,
whenever --arch, --os or --platform are specified, the pull policy will
be forced to "newer".  This way, we pessimistically assume that the
local image has an invalid platform and we reach out to the registry.
If there's a newer image (i.e., one with a different digest), we'll pull
it down.

Please note that most of the logic has either already been implemented
in libimage or been moved down which allows for removing some clutter
from Podman.

[NO TESTS NEEDED] since c/common has new tests.  Podman can rely on the
existing tests.

Fixes: containers#10648
Fixes: containers#10682
Signed-off-by: Valentin Rothberg <[email protected]>
vrothberg added a commit to vrothberg/common that referenced this pull request Jun 23, 2021
As it turned out in Podman CI (containers/podman/pull/10739), the policy
is overridden via --arch/os/platform/variant even when the policy is set
to never.

While I think this is a bug, it is a separate one and must tackled
separately.

Signed-off-by: Valentin Rothberg <[email protected]>
vrothberg added a commit to vrothberg/common that referenced this pull request Jun 23, 2021
As it turned out in Podman CI (containers/podman/pull/10739), the policy
is overridden via --arch/os/platform/variant even when the policy is set
to never.

While I think this is a bug, it is a separate one and must tackled
separately.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg vrothberg mentioned this pull request Jun 23, 2021
@vrothberg
Copy link
Member Author

@containers/podman-maintainers merge me

@mheon
Copy link
Member

mheon commented Jun 23, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jun 23, 2021

/lgtm
/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 23, 2021
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 23, 2021
@openshift-merge-robot openshift-merge-robot merged commit 7ed18ea into containers:master Jun 23, 2021
@vrothberg vrothberg deleted the fix-10682 branch June 24, 2021 06:43
flouthoc added a commit to flouthoc/podman that referenced this pull request Nov 8, 2021
If registry is remote default pull policy must be `missing` instead of
remote. Since `empty str == pullpolicy {always}` for more context on
this behaviour check containers#10739

[NO TESTS NEEDED]

Signed-off-by: Aditya Rajan <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. needs-backport Indicates if changes in a PR should be backported to some releases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman doesn't run image with invalid architecture
5 participants