fix(ci): preserve RHDH-specific template patches across upstream syncs#406
Conversation
The weekly sync workflow's subtree pull silently overwrites RHDH-specific modifications to vendored templates (lightspeed, catalog index images, checksums). Add a sync script that generates a patch of RHDH changes before the pull and re-applies it after, failing loudly if conflicts arise instead of silently dropping changes.
Code Review by Qodo
1. Patch uses wrong base
|
Review Summary by QodoPreserve RHDH template patches across upstream Backstage syncs
WalkthroughsDescription• Add sync script to preserve RHDH template patches during upstream syncs • Prevent silent loss of RHDH-specific modifications to vendored Backstage chart • Surface patch conflicts explicitly with saved patch file for manual resolution • Simplify CI workflow by delegating sync logic to reusable script • Update developer documentation with conflict resolution guidance Diagramflowchart LR
A["Upstream Backstage"] -->|fetch| B["Generate RHDH Patch"]
B -->|save patch| C["Git Subtree Pull"]
C -->|reset to upstream| D["Re-apply RHDH Patch"]
D -->|success| E["Apply Fixups & Commit"]
D -->|conflict| F["Save rhdh-vendored.patch"]
E --> G["Sync Complete"]
F --> H["Manual Resolution Required"]
File Changes1. hack/sync-upstream-backstage.sh
|
- Use [[ ]] instead of [ ] for conditional tests (S7688) - Assign positional parameter to local variable in has_meaningful_diff (S7679) - Redirect error messages to stderr (S7677)
|



Description of the change
The weekly
sync-upstream-backstage.yamlworkflow usesgit subtree pullto sync the vendored Backstage chart from upstream. This silently overwrites RHDH-specific modifications to vendored templates (e.g., Lightspeed integration, catalog index images, checksum annotations inbackstage-deployment.yaml), even when there are no merge conflicts; Git's merge algorithm auto-resolves in favor of upstream.This PR adds a sync script (
hack/sync-upstream-backstage.sh) that wraps the full sync flow:.gitignorefixups and rebuilds vendored.tgzdependenciesIf the patch fails to apply (because upstream changed the same lines), the script saves the patch to
rhdh-vendored.patchand exits with an error, so conflicts are surfaced explicitly rather than silently dropped.The CI workflow now calls this script, and maintainers can use it locally for manual syncs as well.
Which issue(s) does this PR fix or relate to
How to test changes / Special notes to the reviewer
Round-trip verification (already tested locally):
backstage-deployment.yamlto the upstream versionScript test: Run
./hack/sync-upstream-backstage.shlocally. Since we're already in sync with upstream, it should report "No changes from upstream" and exit cleanly.Conflict handling: To test the failure path, manually edit a patched region of the upstream file before applying — the script should fail with a helpful message and save
rhdh-vendored.patch.Checklist
Chart.yamlaccording to Semantic Versioning.values.yamland added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Runpre-commit run --all-filesto run the hooks and then push any resulting changes. The pre-commit Workflow will enforce this and warn you if needed.pre-commithook.ct lintcommand.