Skip to content

Conversation

@umohnani8
Copy link
Member

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]

@umohnani8
Copy link
Member Author

Need containers/image#406 to be merged in first.
Adding tests.
@rhatdan @mheon PTAL

@umohnani8 umohnani8 force-pushed the podman_search branch 3 times, most recently from 2c626e1 to 5aa5dd4 Compare January 18, 2018 18:56
@umohnani8
Copy link
Member Author

Added tests

Copy link
Member

Choose a reason for hiding this comment

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

Your not returning anything?

Copy link
Member Author

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{}) {

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

context.TODO?

Copy link
Member Author

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.

Copy link
Member

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,

Copy link
Member

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
}

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

Same change as above.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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:

  1. --filter=isAutomated=true -> Want all images with isAutomated set to true
  2. --filter =isAutomated=false -> Want all images with isAutomated set to false
  3. no filter set -> Want all images regardless of the image's isAutomated value

Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

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

Ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

Same reasoning as above.

@rhatdan
Copy link
Member

rhatdan commented Jan 18, 2018

Update readme.md and transfer.md

@TomSweeneyRedHat
Copy link
Member

#230 really changed up the README.md, could changes here be held until that's merged?

Copy link
Member

Choose a reason for hiding this comment

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

which config file?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

is-automated?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

putput to output

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

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.

Copy link
Member

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...

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member Author

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

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Need search below.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@umohnani8 umohnani8 force-pushed the podman_search branch 8 times, most recently from 1358783 to 1ad156e Compare January 24, 2018 17:36
@umohnani8 umohnani8 changed the title [WIP] Add podman search command Add podman search command Feb 5, 2018
@umohnani8
Copy link
Member Author

vendoring in latest containers/image with support for searching registries.
This can get in once tests pass.
@rhatdan @mheon PTAL

@rhatdan
Copy link
Member

rhatdan commented Feb 5, 2018

LGTM, but we are stuck with the gomd2man issues.

@umohnani8 umohnani8 force-pushed the podman_search branch 3 times, most recently from f2f44ce to 3fc58b7 Compare February 6, 2018 15:23
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@TomSweeneyRedHat
Copy link
Member

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]>
Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a 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.

@rhatdan
Copy link
Member

rhatdan commented Feb 6, 2018

@rh-atomic-bot r+

@rh-atomic-bot
Copy link
Collaborator

📌 Commit 9e44195 has been approved by rhatdan

@rh-atomic-bot
Copy link
Collaborator

⌛ Testing commit 9e44195 with merge 0d7e6fa...

rh-atomic-bot pushed a commit that referenced this pull request Feb 6, 2018
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
@rh-atomic-bot
Copy link
Collaborator

☀️ Test successful - status-papr
Approved by: rhatdan
Pushing 0d7e6fa to master...

@umohnani8 umohnani8 deleted the podman_search branch May 16, 2018 15:43
@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 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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 this pull request may close these issues.

5 participants