Skip to content

Commit

Permalink
cli: podman manifest add --annotation use StringArray()
Browse files Browse the repository at this point in the history
This option accepts arbitrary input so we should allow commas in it.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed Dec 11, 2023
1 parent 3e10a68 commit d8c3e5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/manifest/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand All @@ -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() {
Expand Down

0 comments on commit d8c3e5b

Please sign in to comment.