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

Split up error messages for missing --sbom related flags #5288

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

nalind
Copy link
Member

@nalind nalind commented Jan 22, 2024

What type of PR is this?

/kind other

What this PR does / why we need it:

Split up the diagnostic for missing SBOM generation settings so that we can more easily tell the difference between "you didn't tell me where to put the output files" and "I don't know how to generate things".

How to verify it

Use --sbom and forget to specify options for where to save the generated files, and wonder if the presets aren't working right.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Not really a bug, but I've confused myself enough times that this probably needed to be changed.

Does this PR introduce a user-facing change?

None

return options, fmt.Errorf("sbom configuration missing one or more of (%q or %q)", "--sbom-scanner-image", "--sbom-scanner-command")
}
if options.SBOMOutput == "" && options.ImageSBOMOutput == "" && options.PURLOutput == "" && options.ImagePURLOutput == "" {
return options, fmt.Errorf("sbom configuration missing one or more of (%q, %q, %q or %q)", "--sbom-output", "--sbom-image-output", "--sbom-purl-output", "--sbom-image-purl-output")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this if triggers, it's missing "all" of the options, not "one or more" as you say here. Or did you mean to make som the && be ||?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least one of them needs to be specified, but it's fine if any of them are while the rest aren't. I'm not sure how best to word that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can;'t we just pick a default, and maybe allow it to be configured in containers.conf?

Split up the diagnostic for missing SBOM generation settings so that we
can more easily tell the difference between "you didn't tell me where to
put the output files" and "I don't know how to generate things".

[NO NEW TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Feb 7, 2024

/approve
/lgtm
/hold

Copy link
Contributor

openshift-ci bot commented Feb 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nalind, rhatdan

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

@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

/hold cancel

@TomSweeneyRedHat
Copy link
Member

/lgtm

@openshift-merge-bot openshift-merge-bot bot merged commit 35d2366 into containers:main Feb 8, 2024
34 checks passed
@nalind nalind deleted the sbom branch February 8, 2024 14:53
@stale-locking-app stale-locking-app bot locked as resolved and limited conversation to collaborators May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants