fix: handle YAML parse errors in find_templates_of_type - #166
Conversation
Templates wrapped with Helm conditionals (e.g. {{- if }}) by earlier
phases cannot be parsed by yaml.safe_load. This aligns generate-charts.py
with bundles-to-charts.py which already handles this with try/except.
Signed-off-by: dislbenn <dbennett@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dislbenn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: stolostron/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
find_templates_of_typeingenerate-charts.pycrashes when encountering templates wrapped with Helm conditionals (e.g.{{- if .Values.global.networkPolicies.enabled }}). The{{syntax is interpreted as a YAML flow mapping, causingyaml.safe_loadto fail. This was introduced when NetworkPolicy wrapping was added — the wrapping phase modifies template files, then a later phase tries to parse all templates and crashes on the modified ones.Related Issue
Caused by #164 / #165 which added NetworkPolicy conditional wrapping to chart generation.
Changes Made
try/except yaml.YAMLErroraroundyaml.safe_loadinfind_templates_of_typeto skip unparseable templatesfileYmland switched fromfileYml['kind']tofileYml.get('kind')to preventKeyError/TypeErrorgenerate-charts.pywithbundles-to-charts.pywhich already handles this correctlyScreenshots (if applicable)
N/A
Checklist
Additional Notes
N/A
Reviewers
/cc @cameronmwall @ngraham20
Definition of Done