New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
manifest add: complain if we get artifact flags without --artifact #5366
manifest add: complain if we get artifact flags without --artifact #5366
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cmd/buildah/manifest.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we report all of these at once, rather then one at a time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Changed it.
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>
171ae78
to
8a1bcd5
Compare
LGTM |
/lgtm |
What type of PR is this?
/kind other
What this PR does / why we need it:
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".How to verify it
Attempt to use one of the "--artifact-type", "--artifact-config", "--artifact-config-type", "--artifact-layer-type", "--artifact-subject", or "--artifact-exclude-titles" flags with
buildah manifest add
without also specifying "--artifact". It can be an easy thing to overlook, and if your filename happens to look like an image name, the error message you'd have gotten about it could be more confusing.Which issue(s) this PR fixes:
None
Special notes for your reviewer:
I added a check for this in containers/podman#21653, and thought it would be a good idea to add it here, too.
Does this PR introduce a user-facing change?