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

fix(command): ignore --format in podman search --list-tags #19063

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
} 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