fix(sbom): stop sbom validate failing on checker warnings - #331
Draft
reyreavman wants to merge 3 commits into
Draft
reyreavman wants to merge 3 commits into
reyreavman wants to merge 3 commits into
Conversation
Treat WARNING lines from sbom-checker as non-fatal: the file is reported as "OK (N warning(s))", warnings go to the warning stream, and the exit code stays 0. Only ERROR lines fail the run unless the new --fail-on-warnings flag is passed. The summary now splits the counts: "N passed, M failed; X error(s), Y warning(s)". Previously parseResult put warnings into the same list as errors, so a single warning marked the file FAILED and exited 1. The pinned checker image does not validate purl yet, so nothing surfaced; the current upstream does, and production OSS SBOMs produce dozens of purl-case warnings that would turn both formats red as soon as the checker image is bumped. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
State in the usage pages (EN and RU) that sbom validate reports errors and warnings separately, that only errors fail the run, and that --fail-on-warnings turns warnings into failures. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Collaborator
Author
Verification
Review focus
Follow-up
|
Replace the nested append with slices.Concat and make the warnings-only e2e entry assert the "OK (1 warning(s))" line rather than just "WARNING", so the per-file summary format is pinned. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Collaborator
Author
Verification
Review focus
Follow-up
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
werf sbom validateno longer fails on sbom-checker warnings: they are printed and counted, but only errors set a non-zero exit code. With the current pinned checker image this is invisible (it emits no purl warnings); with the current upstream ISPRAS checker a production OSS SBOM yields dozens ofWARNING: pkg:golang/github.com/Azure/... не подходит под спецификацию purllines, and today every one of them fails the run.What
sbom validateexiting 1 on WARNING lines (with the pinned image those come only from--check-vcs) now passes; the way back is--fail-on-warnings.(i/N) file.json... OK (M warning(s))and the run exits 0.--fail-on-warnings(defaultfalse): with it, such a file is reportedFAILED, its warnings are listed in the error, and the run exits 1.FAILEDand exits 1 regardless of the flag; its warnings are still printed under it, as before.(i/N) file... OK|FAILEDheader and ERROR lines stay on stdout, sosbom validate > out.txtno longer captures the warnings — use2>&1.Result: N passed, M failed; X error(s), Y warning(s); previously it stopped atM failed.validation failed for <file>:followed by the lines) is unchanged.Why
parseResultappended warnings to the same list as errors, so any warning marked the fileFAILED. The checker's own--errors 0already distinguishes the two classes; werf collapsed them. Left alone, bumping the checker image (tracked separately) immediately turns CI red for bothossandcontainerformats on findings that are not blockers, while a team that does want hard acceptance had no way to opt in either — hence the flag rather than a silent behavior change alone.Shipped as
fixrather than a major bump: the strict default was never documented as a contract, the affected population is pipelines gating on--check-vcswarnings, and the opt-back is a single flag.A
--strictness=errors|allenum was the alternative; a boolean covers the only two levels the checker emits and leaves room to add the enum later if a third class appears.