-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add podman search command #241
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
Conversation
|
Need containers/image#406 to be merged in first. |
2c626e1 to
5aa5dd4
Compare
|
Added tests |
cmd/podman/search.go
Outdated
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.
Your not returning anything?
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.
It is returning genericParams, which has already been defined with the return type in the function definition.
func searchToGeneric(params []searchParams) (genericParams []interface{}) {
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.
Don't you need to say return genericParams? If not you should because it makes it easier to understand for dummies like me.
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.
no you don't, and fixed.
cmd/podman/search.go
Outdated
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.
I think you can use v.NumField() to prebuild the values struct, and things work a little faster.
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.
fixed
cmd/podman/search.go
Outdated
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.
context.TODO?
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.
context.TODO() gives you an empty context when not sure which context to use. It is needed by the functions in containers/image/docker/docker_client.go.
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.
Ok, never seen that interface before,
cmd/podman/search.go
Outdated
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.
You could shrink this by saying
if len(arr) == 2 && arr[1] != "true" {
filterParams.isAutomated = false
} else {
filterParams.isAutomated = true
}
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.
fixed
cmd/podman/search.go
Outdated
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.
Same change as above.
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.
fixed
cmd/podman/search.go
Outdated
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.
Don't need, default booleans to true.
cmd/podman/search.go
Outdated
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.
Default to True and eliminate the set flag.
cmd/podman/search.go
Outdated
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.
Should not need isAutomatedSet and return result.IsAutomated
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.
I don't think I am getting what you mean. If I don't have the isAutomatedSet field, and just compare the isAutomated field of the result to the filter, I will get only the results that have this set to false or true based on the value of filter.isAutomated. But I want all the results regardless of the isAutomated value when the is-automated filter is not set.
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 isAutomated is defaulted to true. Then only changed if the user specifies to remove it with automated == 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.
You are always printing it unless the user tells you not to, so default to true and set it to false when the user tells, then you don't need the rest of the code.
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 that is the case, then when the user only wants images with isAutomated true, they will get all the images regardless of the images isAutomated value. It will work for the false case, but not the true case.
These are the cases:
- --filter=isAutomated=true -> Want all images with isAutomated set to true
- --filter =isAutomated=false -> Want all images with isAutomated set to false
- no filter set -> Want all images regardless of the image's isAutomated value
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.
Ok, I still think we could get by with one variable.
Automated String
Set it to "true", "false" or "" and that gets your three states.
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.
I would go with *bool - that gives us true, false, and nil
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.
Right, forgot we could use pointers. Fixed
cmd/podman/search.go
Outdated
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.
Ditto
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.
Same reasoning as above.
|
Update readme.md and transfer.md |
|
#230 really changed up the README.md, could changes here be held until that's merged? |
docs/podman-search.1.md
Outdated
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.
which config file?
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.
Yes specify the file name.
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.
fixed
docs/podman-search.1.md
Outdated
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.
is-automated?
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.
fixed
docs/podman-search.1.md
Outdated
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.
putput to output
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.
fixed
docs/podman-search.1.md
Outdated
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.
what makes an image "official". A bit more verbiage here or the opening description would be nice.
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.
Of course this only means that someone paid Docker to make it official...
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.
Should I add a description or let it be?
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.
Docker does not describe it and it is for the benefit of Docker to call things official. So I would not describe it. I am not sure if we declare Red Hat images as Official. So lets leave this alone.
cmd/podman/search.go
Outdated
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.
Can/should we allow them to specify more than one registry?
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.
I don't see why not. This is a feature I added as podman search searches multiple registries based on how many are set as default registries in the config file. This was just a way to give the user to specify which registry he/she wants to search without dealing with the lag of searching all default registries.
If we want to allow specifying more than one, it can be done. @rhatdan what do you think?
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.
The config file being /etc/containers/registries.conf
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.
Yes allow me to specify multiple registries, I can even specify ones that are not in registries.conf
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.
fixed
docs/podman-search.1.md
Outdated
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.
suggests "results of" to "results from". If you have 10 results in a registry and limit is set to 3, which 3 do you get? Oldest, newest, alphabetical, other? It would probably be nice to talk about ordering here. Might also be nice to have a way to sort the output.
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.
There is no particular order, just the order in which the api returns the results. docker search sorts it based on the star count, highest to lowest. I didn't bother to do that as that would make search slower, and it is already a bit slow. I don't think podman should care that much about the star count, looks to be mainly a docker hub thing. @rhatdan what are your thoughts? I can definitely clarify that the output is ordered based on the order of the results from the api.
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.
Lets not sort for now, until someone complains.
completions/bash/podman
Outdated
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.
Need search below.
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.
fixed
1358783 to
1ad156e
Compare
1ad156e to
4257224
Compare
|
LGTM, but we are stuck with the gomd2man issues. |
f2f44ce to
3fc58b7
Compare
3fc58b7 to
056264b
Compare
docs/podman-search.1.md
Outdated
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.
A format example would be a nice to have here.
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.
fixed
|
One suggestion, otherwise LGTM. Test failures are unrelated, should we retest? |
Latest containers/image has support for searching registries. Signed-off-by: umohnani8 <[email protected]>
podman search queries a registry for a matching image and prints the output. I added a new flag called "registry" giving the user the option to search a specific registry if they don't want to search all their default registries. Signed-off-by: umohnani8 <[email protected]>
056264b to
9e44195
Compare
TomSweeneyRedHat
left a comment
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.
LGTM, assuming the network testing gremlins stay far away.
|
📌 Commit 9e44195 has been approved by |
podman search queries a registry for a matching image and prints the output. I added a new flag called "registry" giving the user the option to search a specific registry if they don't want to search all their default registries. Signed-off-by: umohnani8 <[email protected]> Closes: #241 Approved by: rhatdan
|
☀️ Test successful - status-papr |
podman search queries a registry for a matching image and prints the output.
I added a new flag called "registry" giving the user the option
to search a specific registry if they don't want to search all
their default registries.
Signed-off-by: umohnani8 [email protected]