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

podman search: --list-tags clobbers --format #8740

Closed
edsantiago opened this issue Dec 16, 2020 · 5 comments · Fixed by #8923
Closed

podman search: --list-tags clobbers --format #8740

edsantiago opened this issue Dec 16, 2020 · 5 comments · Fixed by #8923
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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

@edsantiago
Copy link
Member

podman search --list-tags will output a table, even if --format is requested (either json or {{.Tag}}):

$  ./bin/podman search --list-tags --format json quay.io/podman/stable
NAME                   TAG
quay.io/podman/stable  v1.4.4
quay.io/podman/stable  v1.4.2
...

If possible, the requested --format should be honored. If not possible, there should be a run-time check throwing a conflicting-options error.

Related: #8276

@rhatdan rhatdan added Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/bug Categorizes issue or PR as related to a bug. labels Dec 16, 2020
@yufeifly
Copy link

Hi, I am using podman 2.1.1. When I run command podman search --list-tags --format json quay.io/podman/stable, I get this output Error: unknown flag: --list-tags. Is this due to the podman version?

@rhatdan
Copy link
Member

rhatdan commented Dec 19, 2020

Looks like this did not show up until podman-2.2, which should be available now.

@Afourcat
Copy link
Contributor

Afourcat commented Jan 5, 2021

Hello,
I was trying to fix this issue, but what kind of output are you waiting for?

This output following the same structure of the default option of the podman search command:

{
    "Index": "",
    "Name": "docker.io/library/redis",
    "Description": "",
    "Stars": 0,
    "Official": "",
    "Automated": "",
    "Tag": "2.8.7"
}

Or this output following the structure of the podman search --list-tags command:

{
    "Name": "docker.io/library/redis",
    "Tag": "2.8.7"
}

Thank you for your time and your work.

@edsantiago
Copy link
Member Author

That's a really good question. My first reaction was to go with your first option (populate Tag, leave all other fields the same)... but after thinking about it that just isn't meaningful. Your second option is more natural. One followup suggestion, what would you think of:

{
    "Name": "docker.io/library/redis",
    "Tags": ["2-32bit", "2.6-32bit", "2.6.17-32bit", "2.6.17", "2.6", "..."]
}

Name is useful to canonicalize an input arg, e.g. docker.io/redis would be returned as .../library/redis. Tags is explicitly plural to prevent naïve code from accessing Tag as a scalar; it's also more intuitive given the name of the --list-tags option.

I haven't even peeked at the code, and don't know how easy/hard that would be; nor do I know if this would violate API conventions. @rhatdan @mheon @jwhonce @TomSweeneyRedHat @baude WDYT?

@Afourcat
Copy link
Contributor

Afourcat commented Jan 5, 2021

If it does not violate any conventions, Your suggestion seems better.

For me, the implementation looks feasible. It looks like it could be fixed in this file.

I will implement your output format, and when the community validates that it follows all necessary conventions, I will make a pull request. If it sounds right to you.

Afourcat added a commit to Afourcat/podman that referenced this issue Jan 10, 2021
command.

Data is formatted following this JSON structure:
```json
{
    "Name": "...",
    "Tags": ["...", "...", "..."]
}
```

Closes: containers#8740.

Signed-off-by: Alexandre Fourcat <[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
Good First Issue This issue would be a good issue for a first time contributor to undertake. 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.

4 participants