Repository navigation
feat(bomrc): fail 'check' and 'generate' when a chart yields no images - #41
Merged
Merged
Conversation
A chart that hides its images behind required values produced an empty BOM that passed unnoticed. check and generate now fail when no container image is found unless .bomrc.yml declares expectNoImages: true, and fail when it is declared but images exist, so the declaration cannot go stale. Helm chart references are not counted. check reads the .bomrc.yml next to the BOM and runs the rule before any registry call.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change to require explicit declarations for empty image lists.
No open issues 🎉
What changed in this PR
This PR makes empty image lists an explicit choice rather than a silent success in BOM generation and validation.
Changes:
- Adds
expectNoImagesand a shared check that rejects both undeclared empty image lists and declarations that conflict with discovered images. - Applies the rule after image merging in
generateand before registry calls incheck, using configuration beside the BOM. - Adds tests and documents configuration lookup, exclusions, and format limitations.
| File | Description |
|---|---|
| README.md | Documents expectNoImages behavior and validation constraints. |
| internal/generate/generate.go | Checks image expectations after merging discovered and configured images. |
| internal/generate/generate_test.go | Tests generation with empty, populated, and explicitly declared image lists. |
| internal/check/check.go | Loads BOM-local configuration and checks image counts before registry validation. |
| internal/check/check_test.go | Tests declarations, configuration lookup, malformed configuration, and exclusions. |
| internal/bomrc/config.go | Adds expectNoImages and shared image-count validation. |
| internal/bomrc/config_test.go | Tests validation rules, configuration parsing, and the default value. |
Review effort: Balanced
tuxerrante
marked this pull request as ready for review
November 19, 2026 15:11
tuxerrante
requested review from
NautiluX,
OliverTrautvetter,
gnarlex and
schrodit
November 19, 2026 15:15
schrodit
approved these changes
Nov 20, 2026
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.
Tip
TL;DR —
bom generateandbom checknow fail when a chart yields no container images, unless its.bomrc.ymlsetsexpectNoImages: true.Replaces the silent empty BOM; a declared chart that gains images fails too, so the flag cannot go stale.
Why
A chart that hides its images behind required values produces an empty BOM that passes today, so its images are missing from the release artifact unnoticed. On charts main (43ae0f9) 12 of 70
bom.jsonare empty; each is either intentional or hiding images, and nothing says which.What changed
.bomrc.ymlgetsexpectNoImages;Config.CheckImageCountholds the rule for both commands.generatecounts after discovered andadditionalImagesrefs are merged.checkcounts non-chart components, reads.bomrc.yml/.bomrc.yamlfrom the BOM's directory, and runs before any registry call..bomrc.ymlnow also failscheck(it already failedgenerate).csbom-v2forcheck.Evidence
go test ./...passes. Removing thegenerateguard fails 2 specs, thecheckguard 3, counting pre-merge refs 1.checkandgeneratefail on the same 12 charts (applications, argo-workflows, cdi-cr, central-otel-collector, certificates, cloudflared, dc-otel-collector, image-pre-pull, kyverno-policies, linkerd-crds, pc-applications, readonly-access) and pass the rest. Declaring the flag oncdi-crmakes it pass; declaring it onloki(6 images) fails.Checklist