Helm render error logs#182
Conversation
1672ebb to
39fc84f
Compare
|
🎯 Code Coverage (details) 🔗 Commit SHA: 116f28d | Docs | Datadog PR Page | Give us feedback! |
39fc84f to
012c2b6
Compare
…h failure produces one log line at the outermost resolver sink.
012c2b6 to
5a5d438
Compare
619686e to
e0c9a59
Compare
e0c9a59 to
229d590
Compare
229d590 to
f34a9fd
Compare
f34a9fd to
1a13150
Compare
…ror noise for raw template fallback files.
1a13150 to
116f28d
Compare
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
MikaYuoadas
left a comment
There was a problem hiding this comment.
LGTM, just asked a question to clarify one change.
| } | ||
| // The render failure is already logged by the resolver sink; this is | ||
| // just the fallback announcement, so keep it at Debug. | ||
| contextLogger.Debug().Msgf("Scanning raw files of Helm chart '%s' as a fallback after render failure", path) |
There was a problem hiding this comment.
❓ Question: Why remove the Chart.yaml guard? Do we want to emit this log-line for non Helm chart folder too?
There was a problem hiding this comment.
The guard in resolveChartDir was already redundant, resolveChartDir is only reachable after checkConditions passes for a directory, and checkConditions already gates on Chart.yaml existing (lines 427-430). Any path reaching resolveChartDir is guaranteed to be a Helm chart root, so the Debug log can only fire there
Motivation
Many Helm charts in large monorepos are deployed via build systems that inject additional value files at deploy time (release names, datacenter config, OCI image references, etc.) that are not present in the chart's own
values.yaml. The scanner cannot replicate that injection at scan time, so rendering those charts fails with Go template missing-value errors. This is a known, intentional limitation: full value resolution from build metadata would require parsing BAZEL files, which is out of scope given the complexity and narrow population of affected charts.The consequence of these render failures was a severe log-level problem, not a loss of findings. When rendering fails the scanner falls back to scanning raw template files, which still detects and emits genuine security findings, the only degradation is that
resource_namemay contain an unresolved template expression rather than the concrete deployed name. Each render failure was producing 3–4 duplicate ERROR lines across independent pipeline layers, compounding further because each raw template file containing Go template syntax then produced an additional ERROR from the YAML parser. None of these logs carried information not already available at the outermost layer, and their volume made the ERROR logs noisy relative to failures that actually warrant attention.Changes
Helm resolver
All
Error()calls inrunInstallandrenderHelmare removed. Every failure path in those functions now returns the error silently. TheresolverSinkis the canonical signal for a chart render failure and now carries the full specific error message viaerrors.Wraprather than the generic message that previously discarded the underlying cause.Render-failure classification
resolverSinknow distinguishes expected render failures (charts that reference deploy-time values absent at scan time, identified by well-known Go template missing-value error signatures) from unexpected ones. Expected failures log at Debug and register the chart directory as a known fallback; any other render failure stays at Error. The fallback announcement inresolveChartDiris similarly demoted to Debug since the render error is already logged by the layer below.Raw template parse errors
Servicetracks which chart directories failed to render. When the YAML parser fails on a file inside one of those directories, the expected outcome for raw Go templates, the error is logged at Debug. Parse failures on all other files remain at Error, preserving visibility into genuine parser bugs.Author Checklist
QA Instruction
go test ./pkg/runner/... ./pkg/resolver/helm/... ./pkg/engine/provider/...Impact
Only the Helm rendering and raw-template fallback path are affected. No scan results, rule logic, or output formats change, only log levels for known, handled failure conditions are reduced.
Additional Notes
I submit this contribution under the Apache-2.0 license.