Repository navigation
Auto-detect helmCharts and enable helm + load-restrictor flags - #5
Conversation
When the overlay's kustomization.yaml declares a non-empty helmCharts: list, kustomize requires --enable-helm or the build fails. Detect it inline (yq when available, grep fallback) and add the flag automatically. Backward compatible: overlays without helmCharts produce identical output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s present The helmCharts pattern almost always references shared values from the overlay's base/ (e.g. valuesFile: ../../base/values.yaml), which sits outside the overlay root and trips kustomize's default LoadRestrictionsRootOnly with a security error. Argo CD's standard kustomize integration relaxes this for the same reason. Pair the two flags so detection stays a single signal. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6f9b1c4. Configure here.
| HELM_FLAG=(--enable-helm --load-restrictor=LoadRestrictionsNone) | ||
| fi | ||
| elif grep -qE '^helmCharts:[[:space:]]*$' kustomization.yaml 2>/dev/null; then | ||
| HELM_FLAG=(--enable-helm --load-restrictor=LoadRestrictionsNone) |
There was a problem hiding this comment.
Grep fallback misses helmCharts with trailing YAML comments
Medium Severity
The grep fallback pattern '^helmCharts:[[:space:]]*$' requires end-of-line immediately after optional whitespace, so it won't match a helmCharts: line that has a trailing YAML comment (e.g. helmCharts: # deploy nginx). Since the yq path handles this correctly, the two detection paths are inconsistent. When yq is unavailable (i.e. version_label is not set), this false negative means --enable-helm is silently omitted, causing kustomize build to fail with no workaround in the action.
Reviewed by Cursor Bugbot for commit 6f9b1c4. Configure here.
|
🎉 This PR is included in version 1.6.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |


Summary
helmCharts:block in the overlay'skustomization.yamlbefore everykustomize buildand pass--enable-helm --load-restrictor=LoadRestrictionsNoneautomatically.yqwhen available, with agrepfallback (yq is only conditionally auto-installed in this action whenversion_labelis set, so the fallback matters here).helmCharts:produce byte-identical output.Why
Today, an overlay that adds
helmCharts:fails the build withmust specify --enable-helm, and once the flag is added the next failure is usuallysecurity; file '... base/values.yaml' is not in or below '... overlays/<env>'because the helm + shared-base-values pattern crosses kustomize's defaultLoadRestrictionsRootOnly. Argo CD's standard kustomize integration pairs both flags for the same reason. Doing this inline in the action means callers never need to coordinate workflow updates with the day they introduce a Helm chart, and forgetting an opt-in input can't silently break a deploy.Test plan
helmChartswith entries /[]/ absent / comment-only) on yq path and grep fallback path — all match expected behavior.🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it changes how
kustomize buildis invoked in the action (auto-enabling Helm and loosening load restrictions), which can alter validation/output for overlays usinghelmChartsand affects deploy-time safety checks.Overview
This updates the action’s Validate kustomization step to auto-detect a non-empty
helmChartssection inkustomization.yamland, when present, runkustomize buildwith--enable-helm --load-restrictor=LoadRestrictionsNone.The new flags are applied consistently across validation, error re-build output, and the manifest build used for the version-label selector check, with detection using
yqwhen available and agrepfallback when it isn’t.Reviewed by Cursor Bugbot for commit 6f9b1c4. Bugbot is set up for automated code reviews on this repo. Configure here.