Skip to content
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

Merged
merged 1 commit into from Feb 29, 2024

Conversation

nalind
Copy link
Member

@nalind nalind commented Feb 28, 2024

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?

None

Copy link
Contributor

openshift-ci bot commented Feb 28, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -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)
Copy link
Member

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?

Copy link
Member Author

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>
@TomSweeneyRedHat
Copy link
Member

LGTM
and happy green test buttons.
This looks like a good add for Pdoman 5.0, should we merge this in now and/or add a 5.0 label?
@rhatdan PTAL

@rhatdan
Copy link
Member

rhatdan commented Feb 29, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Feb 29, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit f5d7689 into containers:main Feb 29, 2024
36 checks passed
@nalind nalind deleted the artifact-cli-flags branch February 29, 2024 19:49
@edsantiago edsantiago added the No New Tests Allow PR to proceed without adding regression tests label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/other lgtm No New Tests Allow PR to proceed without adding regression tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants