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 ID and Digest filters #1676

Merged
merged 1 commit into from
Sep 29, 2023
Merged

Conversation

umohnani8
Copy link
Member

The id and digest filters for podman images was broken as it would only match on the full ID or Digest, so when users would give a substring of either not results would be given even though there were matches.
Fix to check on prefix now instead.

Helps fix containers/podman#19966

The id and digest filters for podman images was broken
as it would only match on the full ID or Digest, so when
users would give a substring of either not results would be
given even though there were matches.
Fix to check on prefix now instead.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2023

LGTM

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2023

/approve
/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, rhatdan, umohnani8

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-robot openshift-merge-robot merged commit 4fd26cf into containers:main Sep 29, 2023
7 checks passed
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.

The problem with partial matches is that more than one object may match. Podman will hence error out if multiple containers match during name resolution.

We need to do the same here. There is no guarantee (necessarily) in which order images are being filtered so if we have two images starting with the same ID or digest, any of them may be returned.

Hence, for partial matches we need to filter all objects and error out if we have more than one.

@umohnani8 can you follow up on that?

{string(busybox.Digest()), 1, busybox.ID()},
{string(alpine.Digest()), 1, alpine.ID()},
{string(busybox.Digest()[:10]), 1, busybox.ID()},
{string(alpine.Digest()[:10]), 1, alpine.ID()},
Copy link
Member

Choose a reason for hiding this comment

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

Nit: now it seems we're not testing an exact but only a partial match.

@vrothberg
Copy link
Member

I was thinking about my comment above again and believe I was wrong. Assuming there are multiple matches, it's perfectly fine to return all matching objects. If there are callers expecting to find exactly one match, they need to deal with it.

So please ignore my comment.

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 images --filter: documented filters don't work
5 participants