Fix renovate-nix.json5 preset and validate presets in CI#948
Fix renovate-nix.json5 preset and validate presets in CI#948phisco merged 1 commit intocrossplane:mainfrom
Conversation
The matchBaseBranches entries in renovate-nix.json5 contained a stray
single quote inside the regex string ('/'^release-2\.([2-9]|..+)$/'),
which made the JSON5 preset unparseable. As a result every Renovate
run fails during preset resolution with:
ERROR: config-presets-invalid
"validationError": "Preset is invalid JSON (local>crossplane/
crossplane-runtime//.github/renovate-nix.json5)"
FATAL: Unknown error
Because preset resolution happens before any packages are evaluated,
Renovate has been unable to open, rebase, or close any PRs since the
preset was introduced in f1a70c6 ("renovate: Use nix for v2.2 and
newer release branches").
The typo slipped through the existing renovate-config-validator step
for two reasons: it only validates the top-level .github/renovate.json5
and doesn't recursively resolve local> presets, and it only runs in
the scheduled Renovate workflow rather than on pull requests.
This commit:
- Fixes the regex to parse as a single string, matching the
equivalent pattern in crossplane/crossplane.
- Adds a json5 CLI syntax check for every .github/renovate*.json5
alongside renovate-config-validator, both in the Renovate workflow
(to fail fast on the scheduled run) and in a new
validate-renovate-config job in ci.yml (to catch preset parse
errors at PR review time).
Signed-off-by: Philippe Scorsolini <5697904+phisco@users.noreply.github.com>
📝 WalkthroughWalkthroughTwo GitHub Actions workflows receive updates to strengthen Renovate configuration validation. A new job is added to ci.yml to validate Renovate config files during CI runs, while renovate.yml receives an additional syntax-checking step and a formatting adjustment. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
47-54: Consider DRYing the shared validation block.The same preset-syntax + validator snippet now exists in both workflow files. Would you be open to moving it into a shared script or reusable workflow to prevent drift over time?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 47 - 54, The CI contains duplicated steps "Validate Renovate preset syntax" and "Validate Renovate JSON" across workflows; extract these into a single reusable unit by moving the two commands (the json5 loop and the renovate-config-validator run) into either a shell script (e.g., scripts/validate-renovate.sh) invoked from both workflows or into a GitHub reusable workflow that exposes a job (e.g., reusable workflow name "validate-renovate") and then replace the duplicated steps in each CI file with a single call to that script or the reusable workflow; ensure the new script/workflow preserves the exact commands and exit behavior and update both workflow files to call the shared entry point ("Validate Renovate preset syntax" / "Validate Renovate JSON") to avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 47-54: The CI contains duplicated steps "Validate Renovate preset
syntax" and "Validate Renovate JSON" across workflows; extract these into a
single reusable unit by moving the two commands (the json5 loop and the
renovate-config-validator run) into either a shell script (e.g.,
scripts/validate-renovate.sh) invoked from both workflows or into a GitHub
reusable workflow that exposes a job (e.g., reusable workflow name
"validate-renovate") and then replace the duplicated steps in each CI file with
a single call to that script or the reusable workflow; ensure the new
script/workflow preserves the exact commands and exit behavior and update both
workflow files to call the shared entry point ("Validate Renovate preset syntax"
/ "Validate Renovate JSON") to avoid drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 97aa7972-ec0b-40b5-af6f-747f34c1263d
⛔ Files ignored due to path filters (1)
.github/renovate-nix.json5is excluded by none and included by none
📒 Files selected for processing (2)
.github/workflows/ci.yml.github/workflows/renovate.yml
Description of your changes
The
renovate-nix.json5preset had a stray single quote inside twomatchBaseBranchesregex strings:'/'^release-2\.([2-9]|..+)$/'. That extra quote terminated the JSON5 string early and made the preset unparseable, so every Renovate run fails during preset resolution with:See run https://github.com/crossplane/crossplane-runtime/actions/runs/24445182474/job/71419602985.
Because preset resolution happens before any package is evaluated, Renovate has been unable to open, rebase, or close any PRs since the preset was introduced in f1a70c6 ("renovate: Use nix for v2.2 and newer release branches"). Fixing the string to
'/^release-2\.([2-9]|..+)$/'restores the intended regex and matches the equivalent pattern in crossplane/crossplane's config.The typo only exists on
main; therelease-2.2copy of this preset does not yet have the release-branch regex, so no backport is needed.Why CI didn't catch it
The existing
renovate-config-validatorpre-step has two gaps:.github/renovate.json5and does not recursively resolvelocal>presets, so JSON5 syntax errors inrenovate-nix.json5,renovate-earthly.json5, orrenovate-base.json5are invisible to it.mainand is only caught 24h later by the cron.This PR closes both gaps by adding a
json5CLI syntax check for every.github/renovate*.json5:renovate.ymlbefore starting the Renovate job, so the scheduled run fails fast instead of going through Docker pull + Earthly/Nix bootstrap only to die in preset resolution.validate-renovate-configjob inci.yml, so preset parse errors are blocked at PR review time.I reintroduced the typo locally to confirm the new
json5step exits non-zero on the broken file, and confirmed it exits zero after the fix.The same gaps exist in
crossplane/crossplane; I can follow up with an equivalent PR there if this approach looks right.Fixes #
I have:
Run./nix.sh flake checkto ensure this PR is ready for review.Added or updated unit tests.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.