Skip to content

Commit

Permalink
cli: podman manifest annotate --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 d8c3e5b commit 0f02e43
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/annotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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 @@ -347,15 +347,15 @@ 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"})
session.WaitWithDefaultTimeout()
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() {
Expand Down

0 comments on commit 0f02e43

Please sign in to comment.