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

Image list sorted by repository is not always deterministic #23803

Closed
oszi opened this issue Aug 29, 2024 · 2 comments · Fixed by #23887
Closed

Image list sorted by repository is not always deterministic #23803

oszi opened this issue Aug 29, 2024 · 2 comments · Fixed by #23887
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@oszi
Copy link

oszi commented Aug 29, 2024

Issue Description

In certain conditions, podman image list --sort=repository produces different results. See the steps to reproduce.
I think, it's based on the time the images were last touched on the disk.
It would be nice if sort could be tuned by a second field - also fixing this issue. [sort=repository,tag]

Steps to reproduce the issue

alias podman-images="podman image list --filter=dangling=false --sort=repository --format='{{.Repository}}:{{.Tag}}'"
podman pull quay.io/oszi/toolbox:latest quay.io/oszi/toolbox:latest-amd64

podman-images
podman-images | xargs podman pull
podman-images

Describe the results you received

The two tags of the same image are flipped after every pull.

Describe the results you expected

Sorting should always be deterministic.

podman info output

REDACTED / podman-5.2.2-1.fc40.x86_64

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@oszi oszi added the kind/bug Categorizes issue or PR as related to a bug. label Aug 29, 2024
oszi added a commit to oszi/ansible-collections that referenced this issue Aug 29, 2024
oszi added a commit to oszi/ansible-collections that referenced this issue Aug 29, 2024
@oszi oszi changed the title Image list sorted by repository is non-deterministic in certain edge cases Image list sorted by repository is not always deterministic Aug 29, 2024
@Luap99
Copy link
Member

Luap99 commented Sep 6, 2024

Sorting should always be deterministic.

Well sounds like it is if it depends on the pull order.

Anyhow I do agree if we sort by repository it would make sense to imply to also sort the tags as well without having to specify an extra cli arg.

@Luap99 Luap99 self-assigned this Sep 6, 2024
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 6, 2024
When you sort by repository a user most likely also want the tags to be
sorted as well. At the very least to get a stable output as the order
could be changed pull podman tag/pull even if they keep using the same
tag name.

Fixes containers#23803

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@oszi
Copy link
Author

oszi commented Sep 6, 2024

Sounds good. I wasn't sure secondary sorting can be changed internally this easily.
Thank you for the quick fix.

@stale-locking-app stale-locking-app bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Dec 9, 2024
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators Dec 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. 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 a pull request may close this issue.

2 participants