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 an issue with podman save trying to store signatures #11669

Closed
wants to merge 1 commit into from

Conversation

fgiloux
Copy link

@fgiloux fgiloux commented Sep 21, 2021

Issue
Running the following command:

podman save registry.redhat.io/openshift-logging/cluster-logging-operator-bundle@sha256:70d57b8062d855c6e1f38d99c796fdf06ddbc8070447770453f7ac37db5e93f8 -o ./tmp/cluster-logging.5.0.7-27/cluster-logging.5.0.7-27.tar

I get:

Getting image source signatures
Checking if image destination supports signatures
Error: Can not copy signatures to docker-archive:./tmp/cluster-logging.5.0.7-27/cluster-logging.5.0.7-27.tar: Storing signatures for docker tar files is not supported

This is similar to what was raised in this issue and should have been fixed with this PR

Applying this one line code change fixed the issue for me however I am not knowledgeable enough about podman code base to be confident that it is the right way of doing it.

@rhatdan
Copy link
Member

rhatdan commented Sep 21, 2021

@mtrmac @vrothberg PTAL

@rhatdan
Copy link
Member

rhatdan commented Sep 21, 2021

I think I have seen something like this in the CI/CD system when run locally as well.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Thank you! The changes work perfectly fine here but it does not catch all execution paths. I think we should flip the switch in libimage. @mtrmac WDYT?

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgiloux, 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 Sep 21, 2021
@mtrmac
Copy link
Collaborator

mtrmac commented Sep 22, 2021

Thank you! The changes work perfectly fine here but it does not catch all execution paths. I think we should flip the switch in libimage. @mtrmac WDYT?

History: If I’m reading the history correctly, #7956 did hard-code --remove-signatures at the API/engine abstraction level (which seems more work than any of the other options), and it was undone/lost in #10147 . I can’t see that the latter change was intentional.

Tests: … but I also wonder why the podman save remove signature test introduced in the first PR didn’t start failing. (Or rather, I wonder if/how it ever worked, the "save", "remove-signatures=true", without -- before --remove looks suspicious, and I can’t see that PR hooking a CLI flag up. I didn’t try actually running the test, to be fair.)

API: Isn’t pkg/domain/entities.ImageSaveOptions, with RemoveSignatures defaulting to false, a committed ABI by now? If so, I don’t think libimage can just decide to hard-code RemoveSignatures to true (or maybe it would require the caller to opt-in via something like ImageSaveOptions.RemoveSignaturesIfNecessary).

Behavior: I could conceptually see the case for either adding a --remove-signature flag that the user would have to affirmatively opt in to acknowledge that signatures won’t be represented, or just defaulting to that for formats that don’t support signatures (which is currently all of them, but that might not be the case forever), on the theory that the user would rather get something than just a failure, and missing signatures would end up a… teachable moment? The discussion in #7956 strongly leaned towards the latter, although it didn’t discuss the possible format evolution.

I guess if we don’t ask for an explicit opt-in, it would be cleaner for the knowledge about which formats don’t support signatures to be captured captured in libimage, not every single caller of that library. (Or maybe directly in c/image; right now c/image provides that information on a formed ImageDestination, which can be more informative but is a bad fit for image save; this should be a Can[Ever]SupportSignatures property of a transport — and we can’t change the ImageTransport interface directly, so that would involve adding a bit of infrastructure.)

So I think ideally the Podman CLI should set a new RemoveSignaturesIfNecessary boolean that gets forwarded all the way to libimage, and libimage should call a new c/image facility (c/image/transports.CanSupportSignatures(types.ImageTransport) -> {yes, no,unknown} — or maybe “unknown” should map to ”yes”). And I can quite understand the objection that this would be too much work.

@vrothberg
Copy link
Member

@mtrmac @rhatdan how about removing signatures for save for now (i.e., main branch and 3.4). I begin to see it as a regression as podman save ubi8 (and other RH images) started to break.

Once we're back to the status quo, we can improve on that?

@rhatdan
Copy link
Member

rhatdan commented Sep 23, 2021

SGTM

@vrothberg
Copy link
Member

Thanks for kicking things off, @fgiloux! Given the v3.4 release is just around the corner, I will take over and kick it over the finish line.

@fgiloux
Copy link
Author

fgiloux commented Sep 23, 2021

Very good! I am very impressed by your reactivity and the thoughts that have been given into this. You rock.

@fgiloux fgiloux closed this Sep 23, 2021
@mtrmac
Copy link
Collaborator

mtrmac commented Sep 23, 2021

@mtrmac @rhatdan how about removing signatures for save for now (i.e., main branch and 3.4).

Sure. (Basically, a comment to the extent that in the future there may be formats that support signatures, and we wouldn’t want to remove signatures in those cases, is all I’d like to have at this point.)

vrothberg added a commit to vrothberg/libpod that referenced this pull request Sep 23, 2021
Enforce the removal of signatures in `podman save` to restore behavior
prior to the migration to libimage.  We may consider improving on that
in the future.  For details, please refer to the excellent summary by
@mtrmac [1].

[NO TESTS NEEDED] - manually verified but exisiting tests need some
further investigation (see [1]).

[1] containers#11669 (comment)

Signed-off-by: Valentin Rothberg <[email protected]>
@mtrmac
Copy link
Collaborator

mtrmac commented Sep 23, 2021

or just defaulting to that for formats that don’t support signatures (which is currently all of them, but that might not be the case forever)

Actually docker-dir supports signatures right now.

vrothberg added a commit to vrothberg/libpod that referenced this pull request Sep 23, 2021
Enforce the removal of signatures in `podman save` to restore behavior
prior to the migration to libimage.  We may consider improving on that
in the future.  For details, please refer to the excellent summary by
@mtrmac [1].

[NO TESTS NEEDED] - manually verified but exisiting tests need some
further investigation (see [1]).

[1] containers#11669 (comment)

Signed-off-by: Valentin Rothberg <[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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants