Repository navigation
ci: fail the build on unresolved merge-conflict markers - #1661
Conversation
- Mergify opens a backport PR even when its cherry-pick conflicts, committing the markers as-is; nothing fails until the build chokes on them - New Conflict_Markers stage, independent of every other stage, greps the whole tree for `<<<<<<<` / `>>>>>>>` lines and fails in seconds - Whole tree rather than the diff, so markers already on the base branch are reported by name on every PR into it - Binary files are skipped (-I) so stray byte matches do not fail it Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HYd7dbzNqeaaibH62FHLgc
|
@Mergifyio backport servicing/10.0 |
✅ Backports have been createdDetails
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The CI stage is small, self-contained, and its regex, exit-code handling, and pipeline wiring are verified correct and consistent with existing repo conventions.
Review effort: Balanced
Findings: None
What changed in this PR
This PR adds a new Azure Pipelines stage, Conflict Markers, that scans the entire checked-out tree for unresolved merge-conflict markers (<<<<<<< / >>>>>>>) and fails fast when any are found. The motivation is Mergify-generated backport PRs that commit conflict markers as-is, which otherwise only surface deep in a long build; this surfaces them in seconds with each offending file and line listed.
Changes:
- New
build/workflow/stage-conflict-markers.ymltemplate: a singleScanjob that runsgit grep -nIE '^(<<<<<<<|>>>>>>>)( |$)'and maps git grep's exit codes (0 = markers found → fail, 1 = none → pass, >1 = error → fail). build/workflow/pipeline.yml: inserts theConflict_Markersstage withdependsOn: []so it runs immediately and in parallel with other stages.
| File | Description |
|---|---|
| build/workflow/stage-conflict-markers.yml | New stage template; greps tracked files for conflict markers, skips binaries (-I), excludes ======= to avoid Markdown heading false positives, and reports file/line. |
| build/workflow/pipeline.yml | Wires the new Conflict_Markers stage into the pipeline with no dependencies so it runs early and gates the overall build result. |
Notes from verification:
- The
git grep+case $?idiom relies on Azure's inlinebash:not enablingerrexit; this is confirmed in-repo (steps addset -euo pipefailexplicitly when they need it, e.g.stage-build-desktop.yml:93), so the "no matches" (exit 1) path correctly passes. - A tree-wide search with the same pattern finds no matches today, so the stage passes on the current branch.
- Stage/job structure,
pool,vmImage,cancelTimeoutInMinutes: 0, and the top-leveljobs:template layout are consistent with existing templates.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://polite-field-01aa64f0f-1661.eastus2.azurestaticapps.net |
Co-authored-by: Steve Bilogan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
GitHub Issue (If applicable): n/a
PR Type
What is the current behavior?
Mergify opens a backport PR even when its cherry-pick conflicts, and commits the
<<<<<<</>>>>>>>markers as-is. Nothing fails until the build chokes on them, deep in a long run.What is the new behavior?
A new
Conflict Markersstage scans the tree for unresolved conflict markers and fails in seconds, listing each file and line.dependsOn: []), so it does not wait on any other stage.=======is not matched, because it is also a Markdown heading underline. Binary files are skipped.Other information
A PR runs the pipeline YAML from its target branch, so backport PRs are only protected once this stage is also on that release or servicing branch. That backport is a clean cherry-pick.
Tested locally: the scan passes on the current tree, and fails with both marker lines listed when a conflicted file is planted.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HYd7dbzNqeaaibH62FHLgc