-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Search repository tags using --list-tags #7836
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,6 +608,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) { | |
NoTrunc bool `json:"noTrunc"` | ||
Filters []string `json:"filters"` | ||
TLSVerify bool `json:"tlsVerify"` | ||
ListTags bool `json:"listTags"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also need to extend the swagger docs in |
||
}{ | ||
// This is where you can override the golang default value for one of fields | ||
} | ||
|
@@ -618,8 +619,9 @@ func SearchImages(w http.ResponseWriter, r *http.Request) { | |
} | ||
|
||
options := image.SearchOptions{ | ||
Limit: query.Limit, | ||
NoTrunc: query.NoTrunc, | ||
Limit: query.Limit, | ||
NoTrunc: query.NoTrunc, | ||
ListTags: query.ListTags, | ||
} | ||
if _, found := r.URL.Query()["tlsVerify"]; found { | ||
options.InsecureSkipTLSVerify = types.NewOptionalBool(!query.TLSVerify) | ||
|
@@ -650,6 +652,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) { | |
reports[i].Stars = searchResults[i].Stars | ||
reports[i].Official = searchResults[i].Official | ||
reports[i].Automated = searchResults[i].Automated | ||
reports[i].Tag = searchResults[i].Tag | ||
} | ||
|
||
utils.WriteResponse(w, http.StatusOK, reports) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,4 +423,24 @@ registries = ['{{.Host}}:{{.Port}}']` | |
Expect(search.ExitCode()).To(Equal(0)) | ||
Expect(len(search.OutputToStringArray()) > 1).To(BeTrue()) | ||
}) | ||
|
||
It("podman search repository tags", func() { | ||
search := podmanTest.Podman([]string{"search", "--list-tags", "--limit", "30", "docker.io/library/alpine"}) | ||
search.WaitWithDefaultTimeout() | ||
Expect(search.ExitCode()).To(Equal(0)) | ||
Expect(len(search.OutputToStringArray())).To(Equal(31)) | ||
|
||
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/alpine"}) | ||
search.WaitWithDefaultTimeout() | ||
Expect(search.ExitCode()).To(Equal(0)) | ||
Expect(len(search.OutputToStringArray()) > 2).To(BeTrue()) | ||
|
||
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "docker.io/library/alpine"}) | ||
search.WaitWithDefaultTimeout() | ||
Expect(search.ExitCode()).To(Not(Equal(0))) | ||
|
||
search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/"}) | ||
search.WaitWithDefaultTimeout() | ||
Expect(len(search.OutputToStringArray()) == 0).To(BeTrue()) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to add a search for a registry too with a backslash only, no image name. For that and for this test, add a test to make sure the returned lines are greater than 1 and perhaps greater than 2 or 3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you added the test with lines >2, ty! Could you also add a test that lists the tags for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test added. It's not allowed, no tags will be returned for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with not allowing it, but we really should add a note to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hope I'm not being too painful @QiWang19 ! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the error would be "library/" must be a docker reference". Add to the doc "the search term should be repository name". Would this work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, first off, I'd still like to see a test for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. search does not return error, it logs errors to standard logger and returns the 0 entry of the result. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good and it looks like you've added a test for that, TY! |
||
}) |
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.
This is all very contradictory. You're saying at the start that you'll list all tags for each image found in the repository, and then that the full name must be used. I think from our conversations that the image name with the repository must be supplied. I.e. you must do
docker.io/library/alpine
and you can't dodocker.io/library/
oralpine
. Given that assumption: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
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 the docker.io/library/alpine refer to a repository name, if append a tag to it, it will refer to an image?
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.
@QiWang19 yeah, it's confusing and I may not have helped matters. When you push a container image to a registry, it creates a repository from it. How's this?
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.
👍
nicely done @QiWang19