Skip to content

Commit

Permalink
Fix panic in manifest annotate --index
Browse files Browse the repository at this point in the history
When the --index flag is used, `manifest annotate` shouldn't be
expecting a second non-flag argument.

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Dec 5, 2024
1 parent 8ff491b commit 03eea16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/manifest/annotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func annotate(cmd *cobra.Command, args []string) error {
} else {
opts.Annotations = annotations
}
id, err := registry.ImageEngine().ManifestAnnotate(registry.Context(), args[0], args[1], opts)
id, err := registry.ImageEngine().ManifestAnnotate(registry.Context(), listImageSpec, instanceSpec, opts)
if err != nil {
return err
}
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,16 @@ add_compression = ["zstd"]`), 0o644)
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", "annotate", "--index", "--annotation", "left=right", "foo"})
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
// Check added annotations
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world,withcomma"`))
Expect(session.OutputToString()).To(ContainSubstring(`"left": "right"`))
})

It("remove digest", func() {
Expand Down

0 comments on commit 03eea16

Please sign in to comment.