Skip to content

Commit

Permalink
Merge pull request #19063 from BlackHole1/fix-search
Browse files Browse the repository at this point in the history
fix(command): ignore `--format` in `podman search --list-tags`
  • Loading branch information
openshift-merge-robot authored Jun 30, 2023
2 parents b050710 + a16488f commit 92a22bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/podman/images/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ func imageSearch(cmd *cobra.Command, args []string) error {
listTagsEntries := buildListTagsJSON(searchReport)
return printArbitraryJSON(listTagsEntries)
}
rpt, err = rpt.Parse(report.OriginPodman, "{{range .}}{{.Name}}\t{{.Tag}}\n{{end -}}")
if cmd.Flags().Changed("format") {
rpt, err = rpt.Parse(report.OriginUser, searchOptions.Format)
} else {
rpt, err = rpt.Parse(report.OriginPodman, "{{range .}}{{.Name}}\t{{.Tag}}\n{{end -}}")
}
case isJSON:
return printArbitraryJSON(searchReport)
case cmd.Flags().Changed("format"):
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ registries = ['{{.Host}}:{{.Port}}']`
}
})

It("podman search format list tags with custom", func() {
search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "{{.Name}}", "--limit", "1", ALPINE})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
Expect(search.OutputToString()).To(Equal("quay.io/libpod/alpine"))
})

It("podman search attempts HTTP if tls-verify flag is set false", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
Expand Down

0 comments on commit 92a22bb

Please sign in to comment.