Skip to content

Commit

Permalink
manifest add: complain if we get artifact flags without --artifact
Browse files Browse the repository at this point in the history
Complain if `manifest add` is invoked with any of "--artifact-type",
"--artifact-config", "--artifact-config-type", "--artifact-layer-type",
"--artifact-subject", "--artifact-exclude-titles", but not in
conjunction with "--artifact".

[NO NEW TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
  • Loading branch information
nalind committed Feb 28, 2024
1 parent d80ec96 commit 171ae78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/buildah/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ func manifestAddCmd(c *cobra.Command, args []string, opts manifestAddOpts) error
return err
}
} else {
for _, artifactOption := range []string{"artifact-type", "artifact-config", "artifact-config-type", "artifact-layer-type", "artifact-subject", "artifact-exclude-titles"} {
if c.Flags().Changed(artifactOption) {
return fmt.Errorf("--%s requires --artifact", artifactOption)
}
}
var ref types.ImageReference
if ref, err = alltransports.ParseImageName(imageSpec); err != nil {
if ref, err = alltransports.ParseImageName(util.DefaultTransport + imageSpec); err != nil {
Expand Down

0 comments on commit 171ae78

Please sign in to comment.