Skip to content

Add CI check to block PRs targeting backplane branches - #323

Merged
openshift-merge-bot[bot] merged 4 commits into
mainfrom
protect-backplane-branches
May 18, 2026
Merged

openshift-merge-bot[bot] merged 4 commits into
mainfrom
protect-backplane-branches

Conversation

@RadekCap

@RadekCap RadekCap commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a GitHub Actions workflow that fails any PR targeting backplane-* branches
  • Backplane branches are synced from main via fast-forward (ffwd-branch.yaml), so direct PRs are unnecessary and can cause divergence
  • The workflow prints a clear error message directing contributors to target main instead
  • Includes edited event type to catch PRs retargeted to backplane branches
  • Uses permissions: {} for minimal token scope

Ref: ARO-27157

Test plan

  • Open a test PR targeting backplane-5.0 — verify the block job fails with the error message
  • Retarget an existing PR to backplane-5.0 — verify it also triggers the block
  • Verify FFWD sync still works on next push to main
  • Verify existing PRs targeting main are unaffected

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added protection to backplane release branches to enforce contribution workflow. Direct pull requests to these branches are now automatically blocked, with changes required to originate from the main branch.

Backplane branches are synced from main via fast-forward (ffwd-branch.yaml).
Direct PRs to these branches are not needed and can cause divergence.
This workflow fails with a clear error message directing contributors
to target main instead.

Ref: ARO-27157

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 6802e7e8-521c-4c95-a8eb-1c03fe067edd

📥 Commits

Reviewing files that changed from the base of the PR and between a2148dd and 4c8b6e8.

📒 Files selected for processing (1)
  • .github/workflows/protect-backplane-branches.yaml

📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that blocks pull requests targeting branches matching backplane-5* by failing the run and emitting error annotations telling contributors to fast-forward from main and target main instead.

Changes

Branch Protection Workflow

Layer / File(s) Summary
Backplane branch PR trigger and header
.github/workflows/protect-backplane-branches.yaml
Workflow name and pull_request trigger scoped to backplane-5* for opened, reopened, synchronize, and edited.
Blocking job that fails PRs
.github/workflows/protect-backplane-branches.yaml
Workflow block job with empty permissions, emits two ::error:: annotations and exits with status 1, causing the check to fail for PRs to backplane branches.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • stolostron/azure-service-operator#262: Complements this PR by adding an auto-fast-forward workflow that syncs backplane branches from main, forming a coordinated branch protection flow.

Suggested labels

lgtm

Suggested reviewers

  • mzazrivec
  • marek-veber

Poem

🐰 At the branch gate I stand with care,
Error flags up in tidy rows, I stare.
"Fast-forward from main," I softly sing,
Close this PR, then sync — and try again to bring.
Hop, hop, align — keep history fair.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a CI check to block PRs targeting backplane branches, which matches the workflow addition in the changeset.
Description check ✅ Passed The description covers the key aspects (summary, rationale, test plan, issue reference) but is missing the optional template sections like 'How does this PR make you feel' and doesn't fully complete the checklist items.
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 protect-backplane-branches

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 @.github/workflows/protect-backplane-branches.yaml:
- Around line 4-6: The workflow's pull_request trigger only matches branches
"backplane-*" but doesn't include the edited event type, so PR base-branch
retargeting can bypass the job; update the pull_request trigger to include the
edited event (e.g., add types: [opened, synchronize, reopened, edited] under
pull_request) so that events like PR retargeting against backplane-* branches
will run the protection check; modify the trigger definition that currently
references "pull_request" and branch pattern "backplane-*" (the pull_request:
branches: - "backplane-*") to include the edited type.
🪄 Autofix (Beta)

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: ASSERTIVE

Plan: Enterprise

Run ID: 8ca1aa03-0d81-4a05-ae7d-62ab2848ed0a

📥 Commits

Reviewing files that changed from the base of the PR and between 0eb36d0 and 4b6b6eb.

📒 Files selected for processing (1)
  • .github/workflows/protect-backplane-branches.yaml

Comment thread .github/workflows/protect-backplane-branches.yaml Outdated
Self-review finding addressed before external review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/protect-backplane-branches.yaml (1)

3-6: ⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

Include edited event type to prevent bypass via PR retargeting.

The workflow only triggers on the default pull_request types. If a contributor opens a PR targeting main, then later retargets it to a backplane-* branch, the edited event fires but this workflow won't run, allowing the protection to be bypassed.

GitHub Actions pull_request event default types and does retargeting base branch trigger edited type
🔒 Proposed fix to include edited event type
 on:
   pull_request:
     branches:
       - "backplane-*"
+    types:
+      - opened
+      - reopened
+      - synchronize
+      - edited
🤖 Prompt for 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.

In @.github/workflows/protect-backplane-branches.yaml around lines 3 - 6, The
workflow triggers only on the default pull_request events and omits the edited
type, which allows PRs retargeted to backplane-* branches to bypass the check;
update the on: pull_request block (the existing pull_request trigger that
filters branches "backplane-*") to include the edited event (e.g., add types:
[edited] or include edited alongside other types) so that retargeting a PR into
a backplane-* branch will run this workflow.
🤖 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.

Duplicate comments:
In @.github/workflows/protect-backplane-branches.yaml:
- Around line 3-6: The workflow triggers only on the default pull_request events
and omits the edited type, which allows PRs retargeted to backplane-* branches
to bypass the check; update the on: pull_request block (the existing
pull_request trigger that filters branches "backplane-*") to include the edited
event (e.g., add types: [edited] or include edited alongside other types) so
that retargeting a PR into a backplane-* branch will run this workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 6ce04bdb-a255-48a9-b9c3-4ec5eeb79a96

📥 Commits

Reviewing files that changed from the base of the PR and between 4b6b6eb and ed9fa3a.

📒 Files selected for processing (1)
  • .github/workflows/protect-backplane-branches.yaml

CodeRabbit finding #1 for PR #323:
- File: .github/workflows/protect-backplane-branches.yaml:4-6
- Add edited event type to catch base branch retargeting bypass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@RadekCap RadekCap left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Implemented - CodeRabbit Finding #1

Added types: [opened, reopened, synchronize, edited] to catch base branch retargeting bypass.

Commit: a2148dd04

@RadekCap

Copy link
Copy Markdown
Collaborator Author

AI Review Pipeline Summary

Category Details
Self-Review 1 finding found, 1 commit
Security Review 0 findings
CodeRabbit 2 rounds, 1 accepted, 0 denied
Pre-merge Checks 0 failures
Qodo No findings

Accepted Findings

# Source Description File Commit
1 Self-Review Add explicit empty permissions: {} block .github/workflows/protect-backplane-branches.yaml ed9fa3ae0
2 CodeRabbit Add edited event type to catch base branch retargeting bypass .github/workflows/protect-backplane-branches.yaml:4-6 a2148dd04

All CodeRabbit threads resolved: Yes. PR description updated: Already current (no changes made).

🤖 Generated by /ai-review pipeline

The original backplane-* glob also blocks PRs to backplane-2.x branches
which are still actively maintained. Restrict to backplane-5* as intended
by ARO-27157.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@marek-veber marek-veber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

@marek-veber marek-veber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci

openshift-ci Bot commented May 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marek-veber, RadekCap

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [RadekCap,marek-veber]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 34d5934 into main May 18, 2026
8 checks passed
@openshift-merge-bot
openshift-merge-bot Bot deleted the protect-backplane-branches branch May 18, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants