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 inspection of unsigned schema1 images #1748

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

mtrmac
Copy link
Contributor

@mtrmac mtrmac commented Nov 20, 2023

… by not doing anything, like with the (much more common) signed schema1 images.

Fixes containers/podman#20156 .

... just because this is incorrect and confusing.

Should not change behavior.

Signed-off-by: Miloslav Trmač <[email protected]>
... by not incorrectly invoking the schema2 code; otherwise
it tries to unmarshal nil as JSOn, and fails.

I'm not sure whether schema1 images can contain
a comment or a health check; just not crashing is
an improvement.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac
Copy link
Contributor Author

mtrmac commented Nov 20, 2023

(It would be nice to have unit tests for inspect, but I’m primarily working on other things; this is just a minimal change so that the original diagnosis is not completely lost.)

@mtrmac
Copy link
Contributor Author

mtrmac commented Nov 20, 2023

Tested manually:

$ for f in oci v2s2 v2s1; do skopeo copy --format $f docker://quay.io/libpod/alpine dir:f-$f || break; done
$ cp -a f-v2s1 f-v2s1-unsigned
$ vi f-v2s1-unsigned/manifest.json # to remove the "signatures" top-level field
$ for f in oci v2s2 v2s1 v2s1-unsigned; do bin/podman rmi -a && skopeo copy --preserve-digests dir:f-$f containers-storage:f-$f && bin/podman image inspect f-$f || break; done

The skopeo copy directly to c/storage is necessary because:

  • podman pull dir:v2s1 fails, the logic to determine image ID doesn’t handle schema1
  • a straightforward skopeo copy dir:… docker://…, to then use an ordinary pull, triggers an update of the schema1’s embedded registry name, and that in turn causes skopeo always to add a digest. That’s not happening when writing to c/storage.

@rhatdan
Copy link
Member

rhatdan commented Nov 20, 2023

LGTM

@rhatdan
Copy link
Member

rhatdan commented Nov 21, 2023

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.

/lgtm

Copy link
Contributor

openshift-ci bot commented Nov 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtrmac, 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-merge-bot openshift-merge-bot bot merged commit e2da7be into containers:main Nov 21, 2023
6 checks passed
@mtrmac mtrmac deleted the schema1 branch November 21, 2023 15:53
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.

Podman inspect fail with Error: readObjectStart
3 participants