NO-JIRA: fix: ephemeral config override merge + Go-template variable scan - #740
Conversation
…rrides _inject_ephemeral_config deleted and replaced every file in config/ephemeral/, including defaults.yaml, when an override directory was supplied. Since overrides are typically partial, any base environment setting they didn't include (e.g. dns.domain) silently disappeared from the config used to provision the environment. Scope the delete-and-replace behavior to region YAML files only, and deep-merge defaults.yaml with the override instead of replacing it, reusing the same load_and_merge utility already used by _apply_provision_overrides elsewhere in this file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…iables
scan_template_variables() flagged if/else/end as undocumented context
variables when they appeared inside an escaped Go template string
(e.g. {{ '{{ if .foo }}X{{ else }}Y{{ end }}' }} — used to emit literal
Go template syntax into rendered output). Add a regex that identifies
these escaped spans and skip any variable match whose position falls
inside one, so only real Jinja2 variables are reported.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe change preserves default ephemeral configuration during overrides and replaces only region files. It also prevents escaped Go-template keywords from being reported as Jinja variables, with coverage for double- and single-quoted literals. ChangesEphemeral configuration overrides
Template variable scanning
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/render.py`:
- Around line 427-429: Update _is_inside_escaped_go_template to avoid closing
over the loop-local skip_ranges variable by accepting skip_ranges as an explicit
argument, and update all call sites accordingly; preserve the existing
range-check behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 36bbd936-d870-4c88-ac01-71af39a6d6fc
📒 Files selected for processing (3)
ci/ephemeral-provider/orchestrator.pyscripts/render.pyscripts/test_render.py
…e loop It was redefined as a closure on every iteration of scan_template_variables' outer loop, needlessly capturing skip_ranges. Take skip_ranges as an explicit parameter and define the helper once at module scope instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
typeid
left a comment
There was a problem hiding this comment.
/lgtm
/approve
/test on-demand-e2e
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: typeid 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 |
|
@theautoroboto: This pull request explicitly references no jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
fbd99d5
into
openshift-online:main
Summary
Two independent bug fixes extracted from the self-managed Karpenter migration branch (#698), landing ahead of it since neither depends on the cluster rebuild:
_inject_ephemeral_configdeleted and replaced every file inconfig/ephemeral/, includingdefaults.yaml, when a.ephemeral-env/override directory was supplied. Since overrides are typically partial, any base environment setting they didn't include (e.g.dns.domain) silently disappeared from the config used to provision the environment. Now only region YAML files are replaced;defaults.yamlis deep-merged with the override instead, reusing the sameload_and_mergeutility already used by_apply_provision_overrideselsewhere in the file.scan_template_variables()misreported Go template keywords (if/else/end) as undocumented Jinja variables when they appeared inside an escaped Go template string (e.g.{{ '{{ if .foo }}X{{ else }}Y{{ end }}' }}, used to emit literal Go template syntax into rendered output). This affectsconfig/templates/argocd-bootstrap/applicationset.yaml.j2today. Added a regex that identifies these escaped spans and skips any variable match inside one.Test plan
python3 -m pytest scripts/test_render.py— 170 passed, including two new tests covering single- and double-quoted escaped Go template stringspython3 -m py_compileon both changed filesscan_template_variables()against this repo's realconfig/templates/directory to confirm no regressions on live templates🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests