From 0f02e43cee0a502a664c90b1786cd293a7dfed11 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 8 Dec 2023 18:25:00 +0100 Subject: [PATCH] cli: podman manifest annotate --annotation use StringArray() This option accepts arbitrary input so we should allow commas in it. Signed-off-by: Paul Holzinger --- cmd/podman/manifest/annotate.go | 2 +- test/e2e/manifest_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go index 73f1b18cbd..c628e3e0fe 100644 --- a/cmd/podman/manifest/annotate.go +++ b/cmd/podman/manifest/annotate.go @@ -31,7 +31,7 @@ func init() { flags := annotateCmd.Flags() annotationFlagName := "annotation" - flags.StringSliceVar(&manifestAnnotateOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image") + flags.StringArrayVar(&manifestAnnotateOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image") _ = annotateCmd.RegisterFlagCompletionFunc(annotationFlagName, completion.AutocompleteNone) archFlagName := "arch" diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index 7c60e67978..071239f4fb 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -347,7 +347,7 @@ add_compression = ["zstd"]`), 0o644) session = podmanTest.Podman([]string{"manifest", "add", "foo", imageListInstance}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world", "--arch", "bar", "foo", imageListARM64InstanceDigest}) + session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world,withcomma", "--arch", "bar", "foo", imageListARM64InstanceDigest}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"manifest", "inspect", "foo"}) @@ -355,7 +355,7 @@ add_compression = ["zstd"]`), 0o644) Expect(session).Should(ExitCleanly()) Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`)) // Check added annotation - Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world"`)) + Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world,withcomma"`)) }) It("remove digest", func() {