-
Notifications
You must be signed in to change notification settings - Fork 2.7k
search tags in reverse order #26338
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
base: main
Are you sure you want to change the base?
search tags in reverse order #26338
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: arsenalzp The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Oleksandr Krutko <[email protected]> improve man page, remove duplicated import Signed-off-by: Oleksandr Krutko <[email protected]>
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
please add a release note to this ... it is currently |
@@ -101,6 +103,26 @@ registries = []` | |||
} | |||
}) | |||
|
|||
It("podman search list tags in reverse order", func() { | |||
searchAscending := podmanTest.Podman([]string{"search", "--list-tags", ALPINE}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider podmanTest.PodmanExitCleanly
for this call and the next. You can then eliminate 109-12.
@@ -91,6 +91,10 @@ The result contains the Image name and its tag, one line for every tag associate | |||
|
|||
Do not truncate the output (default *false*). | |||
|
|||
#### **--reverse-order** | |||
|
|||
List tags in reverse order. Default is false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of reverse order as a description, can you describe it in terms of time like you did in your commit?
Bool options don't scale well, what when the next person likes it sorted in a different way? Also looking at the code I don't think any sorting is guaranteed whatsoever currently. So the assumption that it is sorted today is somewhat wrong. The code returns the results in the order the registry returned it AFAICT so it relies on the implemenation details of each registry and I doubt the image spec would have that defined in any way. So in short if we do like to have the option to sort then we must have the option to sort in both orders |
Hello, |
First, let’s talk about how this does not implement #26053 : that asks for “newest” tags, not “alphabetically latest” tags.
But, the most important part is that the whole idea of #26053 is badly targeted: If the goal is to list the latest tag, that should use a “list tags in a repo” API, not an ill-defined “registry search with no defined semantics” API. Registries can, and do, limit the number of results. So, the latest tag might not be in the list at all! My first recommendation is to use
Yes: The order, and the subset the registry chose to return. |
Oops, |
So, what it the decision for this particular issue? Should it be closed? |
I’m leaning towards closing (as long as piping the output of |
Maybe @justin-octo can clarify on the exact request based on the points above. But yeah logically one can do If the ask is just sorting by string asc/desc like this PR then I would not object to adding it but adding more complex stuff such as semver parsing seems out of scope to me. |
So, the primary goal is to be able to easily identify the image tagged with the version number where the image is the same as the one tagged "latest". I currently do this by eyeball on the Docker Hub web site. Being able to sort "pushed date" by most recent would allow me to do this from podman search, rather than having to go to the Docker Hub (or other registry) web site. Hopefully that makes sense. If there is some better way to do this, I'm all ears? But also, being able to sort by the "pushed date" would be useful as you all mentioned above. |
When I do:
I only get the first 26 Tags (oldest from what I can tell). If I read above correctly, this order is determined by the registry. So, obviously, if there are hundreds of tags, I'm going to have to "page" all the way to the end to find the newest tags. This seems like a lot of wasted data if all I want is the 25 newest tags. So, being able to reverse that sort order is what I was hoping for. And get the 25 newest, instead of the 25 oldest (or list them all, and then deal with hundreds of lines and multiple pages). |
That would be interesting but the vendor-neutral registry protocol has no support for looking up tags by images (by digests). The code would have to fetch the manifest for each tag, as one HTTP request per tag. It’s software that could be written but it’s such a number of requests, especially in the worst cases, that I don’t think this should be available as a convenient option. Of course it can be scripted using Presumably the author of the image knows which image is the latest, and can provide that information using some other channel than a registry. Or maybe that specific registry implementation has its own private API that exposes something relevant.
That would also be interesting, and it’s, again, not something available in the vendor-neutral registry protocol. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If the searchReport is already sorted, then you can just reverse it.
- Your commit message says "remove duplicated import" and I'm not sure what this refers to.
Yes, I did reverse.
I added another package import with different alias, it was removed. By the way there is no decision if introduced changes are needed. I guess this PR will be closed. |
This PR is intended to implement feature requested in issue #26053
As tags list might be either in ascending or descending order I decided to use boolean option
--reverse-order
instead of--order=newest
and--order=older
.The option
--reverse-order
is meaningful by itself.Does this PR introduce a user-facing change?