From d8c3e5b3c1ce38c20b6bf9b28d8a8ad4174e1d1c Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 8 Dec 2023 18:18:24 +0100 Subject: [PATCH] cli: podman manifest add --annotation use StringArray() This option accepts arbitrary input so we should allow commas in it. Signed-off-by: Paul Holzinger --- cmd/podman/manifest/add.go | 2 +- test/e2e/manifest_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go index 490be688b9..f957ee4632 100644 --- a/cmd/podman/manifest/add.go +++ b/cmd/podman/manifest/add.go @@ -48,7 +48,7 @@ func init() { flags.BoolVar(&manifestAddOpts.All, "all", false, "add all of the list's images if the image is a list") annotationFlagName := "annotation" - flags.StringSliceVar(&manifestAddOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image") + flags.StringArrayVar(&manifestAddOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image") _ = addCmd.RegisterFlagCompletionFunc(annotationFlagName, completion.AutocompleteNone) archFlagName := "arch" diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index 744108dcff..7c60e67978 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -314,7 +314,7 @@ add_compression = ["zstd"]`), 0o644) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) Expect(session.ErrorToString()).To(ContainSubstring("no value given for annotation")) - session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "foo", imageList}) + session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "--annotation", "key=val,withcomma", "foo", imageList}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) session = podmanTest.Podman([]string{"manifest", "inspect", "foo"}) @@ -324,7 +324,7 @@ add_compression = ["zstd"]`), 0o644) var inspect define.ManifestListData err := json.Unmarshal(session.Out.Contents(), &inspect) Expect(err).ToNot(HaveOccurred()) - Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga"})) + Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga", "key": "val,withcomma"})) }) It("add --os", func() {