Skip to content

fix(ci): stop backport workflow from cascading on its own PRs - #2584

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
worktree-fix-backport-label-cascade
May 6, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
worktree-fix-backport-label-cascade

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Fix the cascade where merging a backport PR (e.g. #2579) spawns another backport (e.g. #2581 [Backport release-1.2] [Backport release-1.3] …).

Two compounding issues:

  1. pr-labeler.yaml auto-added the backport label to any PR whose title started with [Backport release-X.Y] — exactly the prefix korthout/backport-action puts on every backport PR. Introduced in c8ed1c65 (CNCF/k8s label conventions). Fixed by dropping that toAdd.add('backport') line.
  2. dosubot[bot] independently re-applies backport-previous to backport PRs based on similarity to the parent PR; it cannot be controlled from this repo. Fixed by gating both jobs in backport.yaml on pull_request.base.ref == 'main', so backport PRs (which target release-X.Y) cannot trigger the workflow regardless of labels.

Verified pre-fix behaviour by inspecting the label-event timeline of #2580 (dosubot adds backport-previous 47s after PR open) and the diff of c8ed1c65 adding pr-labeler.yaml.

Release note

fix(ci): backport automation no longer creates duplicate backport PRs when a backport PR is merged.

Summary by CodeRabbit

  • Chores
    • Enhanced backport automation workflow with additional safety checks to ensure operations only process pull requests targeting the main branch.
    • Simplified pull request labeling workflow to streamline label assignment logic.

Two compounding issues caused merging a backport PR to spawn another
backport (e.g. #2581 [Backport release-1.2] [Backport release-1.3] ...
from #2579):

1. pr-labeler auto-added the `backport` label to any PR whose title
   started with `[Backport release-X.Y]` (regression introduced in
   c8ed1c6 when pr-labeler.yaml was first added). korthout/backport-
   action puts that prefix on every backport PR it creates, so the
   label was being re-applied to every backport, satisfying the
   workflow's gate when the backport itself was merged.

2. Even with that fixed, an external labeling bot (dosubot) still
   re-applies `backport-previous` to backport PRs based on similarity
   to the parent. That bot is configured at the org level and cannot
   be controlled from this repo.

Drop the `toAdd.add('backport')` line from pr-labeler so the label
isn't propagated by us, and gate both backport jobs on
`pull_request.base.ref == 'main'` so backport PRs (which target
release-X.Y) cannot trigger the workflow regardless of what labels
end up on them.

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce14e7a8-b9b1-4f3f-b57f-5c05870ca50c

📥 Commits

Reviewing files that changed from the base of the PR and between 7585b0c and af317f1.

📒 Files selected for processing (2)
  • .github/workflows/backport.yaml
  • .github/workflows/pr-labeler.yaml
💤 Files with no reviewable changes (1)
  • .github/workflows/pr-labeler.yaml

📝 Walkthrough

Walkthrough

This PR refines the backport workflow by adding branch-safety guards to the GitHub Actions backport and prepare jobs to ensure they only execute when the PR base is main, and removes a redundant backport label from the PR labeler workflow.

Changes

Backport Workflow Refinement

Layer / File(s) Summary
Job Execution Guards
.github/workflows/backport.yaml
Both the prepare and backport jobs now include conditional checks requiring base.ref == 'main' to prevent execution on non-main base branches.
Label Cleanup
.github/workflows/pr-labeler.yaml
The backport label is removed from the backport-match branch; area/release labeling remains unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A guard on the gate, a label set free,
Main branch only, that's the decree!
Backport flows safely, no stray pulls today,
Clean workflow magic—hip hop, hooray! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main issue: preventing the backport workflow from triggering on its own generated PRs, which is the core problem solved by both file changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-fix-backport-label-cascade

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added area/ci Issues or PRs related to CI workflows, GitHub Actions, automation kind/bug Categorizes issue or PR as related to a bug size/XS This PR changes 0-9 lines, ignoring generated files labels May 6, 2026
@dosubot dosubot Bot added the area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) label May 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — both fixes are necessary and the base.ref guard is the right invariant.

The two roots of the cascade are independent. The pr-labeler self-cascade (prefix [Backport release-X.Y] is exactly what korthout/backport-action emits on its own PRs) exists regardless of any external bot, so dropping that line is required. The base.ref == 'main' guard makes the workflow robust against any future label source — manual, third-party, or otherwise — rather than relying on label hygiene as the safety boundary.

Follow-up (separate PR, not blocking this one): the backport and backport-previous labels do not match the namespaced scheme declared in the header of .github/labels.yml (which says it follows the Kubernetes convention). Upstream uses kind/backport. Worth a small PR that renames in labels.yml (with aliases: to preserve history on already-tagged PRs) and updates every reference in .github/workflows/*.yaml in lockstep.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 5096e3b into main May 6, 2026
12 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the worktree-fix-backport-label-cascade branch May 6, 2026 15:03

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The two compounding issues are correctly identified and the fix targets both:

  • backport.yaml: gating both jobs on pull_request.base.ref == 'main' is the right structural lock — backport PRs target release-X.Y so they cannot self-trigger regardless of what label dosubot[bot] (or anything else outside this repo) sticks on them later. This is the layer that actually stops the cascade.
  • pr-labeler.yaml: dropping the auto-add of backport on [Backport release-X.Y] titles is the cooperative half — combined with the base-ref gate, even if dosubot or a future automation adds the label back, the workflow still won't fire.

Defense in depth, correct shape. The area/release auto-tagging on backport titles stays, which is what we want for triage.

Ship it.

Aleksei Sviridkin (lexfrei) added a commit that referenced this pull request Jun 9, 2026
## What this PR does

Expands `docs/release.md` from a ~165-line process-design doc into a
~573-line single source covering both the process design (kept verbatim
— mermaid diagrams and the RC/regular/patch numbered walkthroughs) and
the operational playbook for cutting a release.

New sections added under the existing diagrams:

- **What CI does on a tag push** — phase-by-phase walk through
`tags.yaml` (`prepare-release`, `generate-changelog`,
`update-website-docs`), `pull-requests-release.yaml` (finalize), and
`update-releasenotes.yaml` (sync release body).
- **Automated patch tag** — `auto-release.yaml`'s nightly behavior.
- **Backports** — bot mechanism, recursive-backport regression history
(fix #2584), manual fallback, cherry-pick triage include/skip rule,
monotonic-counter trap for migration backports.
- **Changelogs** — pointer to `agents/changelog.md` plus the recurring
failure modes that have shipped in real changelogs, with a verification
snippet (chart-bump coverage, range-vs-changelog PR sweep, URL liveness,
website PR-author check).
- **Release-time fires** — three customer-impacting regressions (v1.3.0
cert-manager ingressClassName, v1.4.0 kubevirt-instancetypes upgrade,
v1.4.0 Flux 2.7 → 2.8 readiness deadlock) with "what would have caught
this" notes.
- **Pre-release verification checklist**, **CI failures release
engineers commonly hit**, **Force-retagging** (with open RFC #2677
context), **Splitting a release-blocking bundle PR**, **Cleanup after
release**.

Example version numbers across the walkthrough switched from the
upstream `v0.42.x` legacy placeholders to simple semver-style (`v1.2.0`,
`v1.2.1`, `release-1.2`) consistent with semver.org examples and
applicable at any point in v1.x.

### Release note

```release-note
NONE
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Enhanced release process documentation with clarified CI workflows,
comprehensive verification checklists, expanded troubleshooting
guidance, and case studies to ensure more reliable releases.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/cozystack/cozystack/pull/2732?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Issues or PRs related to CI workflows, GitHub Actions, automation area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) kind/bug Categorizes issue or PR as related to a bug size/XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants