Skip to content

feat(bomrc): fail 'check' and 'generate' when a chart yields no images - #41

Merged
tuxerrante merged 1 commit into
mainfrom
feat/expect-no-images
Nov 20, 2026
Merged

tuxerrante merged 1 commit into
mainfrom
feat/expect-no-images

Conversation

@tuxerrante

Copy link
Copy Markdown
Member

Tip

TL;DR — bom generate and bom check now fail when a chart yields no container images, unless its .bomrc.yml sets expectNoImages: 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.json are empty; each is either intentional or hiding images, and nothing says which.

What changed

  • .bomrc.yml gets expectNoImages; Config.CheckImageCount holds the rule for both commands.
  • generate counts after discovered and additionalImages refs are merged. check counts non-chart components, reads .bomrc.yml/.bomrc.yaml from the BOM's directory, and runs before any registry call.
  • A malformed .bomrc.yml now also fails check (it already failed generate).
  • README documents the field, the BOM-directory lookup, and that image-less BOMs need csbom-v2 for check.

Evidence

  • go test ./... passes. Removing the generate guard fails 2 specs, the check guard 3, counting pre-merge refs 1.
  • Built binary over a charts main export: check and generate fail 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 on cdi-cr makes it pass; declaring it on loki (6 images) fails.
  • Card: https://app.clickup.com/t/24560134/869ffeqd5

Checklist

  • All CI checks pass (lint, test, deploy).
  • Reviewer assigned.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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 expectNoImages and a shared check that rejects both undeclared empty image lists and declarations that conflict with discovered images.
  • Applies the rule after image merging in generate and before registry calls in check, 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 tuxerrante changed the title feat(bomrc): fail check and generate when a chart yields no images feat(bomrc): fail 'check' and 'generate' when a chart yields no images Nov 19, 2026
@tuxerrante
tuxerrante marked this pull request as ready for review November 19, 2026 15:11
@tuxerrante
tuxerrante merged commit c2c23f7 into main Nov 20, 2026
5 checks passed
@tuxerrante
tuxerrante deleted the feat/expect-no-images branch November 20, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants