Skip to content

Commit 2b29b11

Browse files
Replace Prow Tide with GitHub merge queue workflows
This PR replaces the Prow Tide mechanism with native GitHub workflows and merge queue functionality, providing equivalent approval and merge automation without external infrastructure. 1. **approval-labels.yaml**: Handles /lgtm and /approve commands - Adds/removes lgtm and approved labels via PR comments - Permission checking using GitHub API - Only users with write access can approve 2. **hold-label.yaml**: Handles /hold and /unhold commands - Allows maintainers and PR authors to block PRs from merging - Adds/removes do-not-merge/hold label 3. **wip-label.yaml**: Automatic WIP detection - Detects [WIP], WIP:, [Draft], draft status, or 🚧 in PR titles - Auto-manages do-not-merge/work-in-progress label 4. **release-notes-label.yaml**: Release note enforcement - Requires release-note, release-note-action-required, or release-note-none - Blocks merge if missing release note label 5. **needs-rebase-label.yaml**: Merge conflict detection - Automatically detects merge conflicts - Manages needs-rebase label 6. **merge-readiness.yaml**: Required status check - Verifies both lgtm and approved labels are present - Blocks if any do-not-merge/* or needs-* labels exist - Single source of truth for merge eligibility - **.github/github-merge-queue.md**: Complete documentation - Command reference for /lgtm, /approve, /hold - Workflow diagrams and architecture - Migration guide from Prow Tide - Setup instructions for merge queue - **ci.yaml**: Removed unnecessary job dependencies - Unit tests, linting, and other checks now run in parallel - No longer wait for build job unnecessarily - Faster feedback on PRs - **kind-e2e.yaml**: Added CI check dependency - E2E tests now wait for CI checks to pass on PRs - Prevents wasteful E2E runs on broken code - Push/merge_group events run immediately without waiting - Event-driven (immediate) vs polling (2m delay) - No infrastructure to maintain - Native GitHub UI integration - Simpler permission model - Better visibility with GitHub checks - Works with GitHub merge queue - All existing Prow commands work identically: /lgtm, /approve, /hold - Blocking labels have same effect: do-not-merge/*, needs-* - Permission model uses GitHub repository access (write/admin) Co-authored-by: Claude <claude@anthropic.com>
1 parent b5863e3 commit 2b29b11

10 files changed

Lines changed: 1173 additions & 5 deletions

.github/github-merge-queue.md

Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,331 @@
1+
# GitHub Merge Queue Setup
2+
3+
This document describes the GitHub-based approval and merge system that replaces Prow Tide.
4+
5+
## Overview
6+
7+
The repository now uses GitHub workflows and merge queue instead of Prow Tide for managing PR approvals and merges. This provides:
8+
9+
- Label-based approval system via comment commands
10+
- Required status checks for merge readiness
11+
- Automatic merging via GitHub merge queue
12+
13+
## Workflow Diagram
14+
15+
```mermaid
16+
flowchart TD
17+
Start([PR Created/Updated]) --> AutoChecks{Automatic Checks}
18+
19+
AutoChecks --> WIP[Check WIP Status]
20+
AutoChecks --> ReleaseNote[Check Release Note Label]
21+
AutoChecks --> Rebase[Check Merge Conflicts]
22+
23+
WIP -->|WIP detected| WIPLabel[Add: do-not-merge/work-in-progress]
24+
WIP -->|Ready| WIPRemove[Remove: do-not-merge/work-in-progress]
25+
26+
ReleaseNote -->|Missing label| RNLabel[Add: do-not-merge/release-note-label-needed]
27+
ReleaseNote -->|Has label| RNRemove[Remove: do-not-merge/release-note-label-needed]
28+
29+
Rebase -->|Conflicts| RebaseLabel[Add: needs-rebase]
30+
Rebase -->|Clean| RebaseRemove[Remove: needs-rebase]
31+
32+
WIPLabel --> ManualReview
33+
WIPRemove --> ManualReview
34+
RNLabel --> ManualReview
35+
RNRemove --> ManualReview
36+
RebaseLabel --> ManualReview
37+
RebaseRemove --> ManualReview
38+
39+
ManualReview{Manual Review} -->|Reviewer comments /lgtm| LGTMLabel[Add: lgtm]
40+
ManualReview -->|Maintainer comments /approve| ApprovedLabel[Add: approved]
41+
ManualReview -->|Anyone comments /hold| HoldLabel[Add: do-not-merge/hold]
42+
43+
LGTMLabel --> MergeCheck
44+
ApprovedLabel --> MergeCheck
45+
HoldLabel --> MergeCheck
46+
47+
MergeCheck{Merge Readiness Check}
48+
49+
MergeCheck -->|Has lgtm + approved<br/>No blocking labels| Ready[✅ Status: PASS]
50+
MergeCheck -->|Missing lgtm or approved| NotReady[❌ Status: FAIL<br/>Missing required labels]
51+
MergeCheck -->|Has blocking labels| Blocked[❌ Status: FAIL<br/>Has blocking labels]
52+
53+
Ready --> MergeQueue[Add to Merge Queue]
54+
NotReady --> Wait[Wait for approvals]
55+
Blocked --> Wait
56+
57+
Wait --> ManualReview
58+
59+
MergeQueue --> FinalChecks{All CI Checks Pass?}
60+
FinalChecks -->|Yes| Merge([🎉 PR Merged])
61+
FinalChecks -->|No| Failed([❌ Merge Failed])
62+
63+
style Start fill:#e1f5ff
64+
style Merge fill:#d4edda
65+
style Failed fill:#f8d7da
66+
style Ready fill:#d4edda
67+
style NotReady fill:#fff3cd
68+
style Blocked fill:#f8d7da
69+
style MergeQueue fill:#cfe2ff
70+
```
71+
72+
### Key Points
73+
- **Green boxes** = Success states
74+
- **Yellow boxes** = Waiting/pending states
75+
- **Red boxes** = Blocked/failed states
76+
- **Blue boxes** = Active processing
77+
78+
## Approval System
79+
80+
### Commands
81+
82+
Maintainers with **write** access can use the following commands in PR comments:
83+
84+
#### `/lgtm` - Looks Good To Me
85+
Adds the `lgtm` label to indicate code review approval.
86+
87+
```
88+
/lgtm
89+
```
90+
91+
To remove the label:
92+
```
93+
/lgtm cancel
94+
```
95+
96+
#### `/approve` - Final Approval
97+
Adds the `approved` label to indicate final approval for merge.
98+
99+
```
100+
/approve
101+
```
102+
103+
To remove the label:
104+
```
105+
/approve cancel
106+
```
107+
108+
#### `/hold` - Hold PR from Merging
109+
Adds the `do-not-merge/hold` label to block a PR from merging. Both maintainers and PR authors can use this command.
110+
111+
```
112+
/hold
113+
```
114+
115+
To remove the hold:
116+
```
117+
/unhold
118+
```
119+
or
120+
```
121+
/hold cancel
122+
```
123+
124+
### Permissions
125+
126+
- Only users with **write** access to the repository can use approval commands
127+
- Commands must be placed at the start of a comment
128+
- The bot will react with emoji to indicate status:
129+
- 👀 (eyes) - Processing command
130+
- 👍 (+1) - Label added successfully
131+
- 👎 (-1) - Label removed successfully
132+
- 😕 (confused) - Insufficient permissions
133+
134+
## Automatic Label Management
135+
136+
Several workflows automatically manage labels based on PR state:
137+
138+
### Work in Progress (WIP)
139+
- **Trigger**: PR title contains `[WIP]`, `WIP:`, `[Draft]`, `Draft:`, or 🚧 emoji, or PR is marked as draft
140+
- **Action**: Adds `do-not-merge/work-in-progress` label
141+
- **Resolution**: Remove WIP indicators from title or convert from draft to ready
142+
143+
### Release Notes
144+
- **Trigger**: PR is missing a release note label
145+
- **Action**: Adds `do-not-merge/release-note-label-needed` label
146+
- **Resolution**: Add one of these labels manually, or use commands:
147+
- `release-note` - For user-facing changes
148+
- `release-note-action-required` - For breaking changes requiring user action
149+
- `release-note-none` - For internal changes with no user impact
150+
- **Commands**: `/release-note`, `/release-note-action-required`, `/release-note-none`
151+
- **Permissions**: ⚠️ **PR author ONLY** (following Prow's behavior - this ensures the author takes responsibility for documenting their changes)
152+
153+
### Merge Conflicts
154+
- **Trigger**: PR has merge conflicts with base branch
155+
- **Action**: Adds `needs-rebase` label
156+
- **Resolution**: Rebase or merge the base branch to resolve conflicts
157+
158+
### Hold
159+
- **Trigger**: Someone comments `/hold`
160+
- **Action**: Adds `do-not-merge/hold` label
161+
- **Resolution**: Comment `/unhold` or `/hold cancel`
162+
- **Permissions**: PR author OR maintainers with write access
163+
164+
## Blocking Labels
165+
166+
The following labels will block a PR from merging (checked by the Merge Readiness workflow):
167+
168+
- `do-not-merge/hold` - Manual hold requested
169+
- `do-not-merge/invalid-owners-file` - OWNERS file is invalid
170+
- `do-not-merge/release-note-label-needed` - Missing release note label
171+
- `do-not-merge/requires-unreleased-pipelines` - Depends on unreleased Tekton pipelines
172+
- `do-not-merge/work-in-progress` - PR is still in progress
173+
- `needs-ok-to-test` - PR needs approval to run tests
174+
- `needs-rebase` - PR has merge conflicts
175+
176+
177+
178+
## Enabling Auto-Merge with Merge Queue
179+
180+
Once both required labels are present:
181+
182+
1. The "Merge Readiness Check" status will turn green
183+
2. The PR can be added to the merge queue
184+
3. Enable auto-merge on the PR to have it automatically merge when ready
185+
186+
### Repository Settings
187+
188+
To enable merge queue for the repository:
189+
190+
1. Go to **Settings****General****Pull Requests**
191+
2. Enable **Allow auto-merge**
192+
3. Go to **Settings****Branches****Branch protection rules** for your main branch
193+
4. Enable **Require merge queue**
194+
5. Add **Merge Readiness Check** as a required status check
195+
6. Configure merge queue settings:
196+
- Minimum PRs to merge: 1 (or as desired)
197+
- Maximum PRs to merge: 5 (or as desired)
198+
- Merge method: Squash, merge commit, or rebase (as per project preference)
199+
200+
## Workflow Files
201+
202+
All merge automation workflows are located in `.github/workflows/` with the `pr_` prefix.
203+
204+
### [`pr_approval-labels.yaml`](workflows/pr_approval-labels.yaml)
205+
Handles `/lgtm` and `/approve` commands in PR comments. Manages label addition and removal based on user permissions.
206+
- **Permissions**: Requires write access to the repository
207+
- **Commands**: `/lgtm`, `/lgtm cancel`, `/approve`, `/approve cancel`
208+
209+
### [`pr_hold-label.yaml`](workflows/pr_hold-label.yaml)
210+
Handles `/hold` and `/unhold` commands. Allows maintainers and PR authors to block/unblock PRs from merging by adding/removing the `do-not-merge/hold` label.
211+
- **Permissions**: PR author or users with write access
212+
- **Commands**: `/hold`, `/unhold`, `/hold cancel`
213+
214+
### [`pr_wip-label.yaml`](workflows/pr_wip-label.yaml)
215+
Automatically detects work-in-progress PRs by checking for:
216+
- PR titles starting with `[WIP]`, `WIP:`, `[Draft]`, or `Draft:`
217+
- Draft PR status
218+
- 🚧 emoji in title
219+
220+
Adds/removes `do-not-merge/work-in-progress` label accordingly.
221+
222+
### [`pr_release-notes-label.yaml`](workflows/pr_release-notes-label.yaml)
223+
Checks for release note labels on PRs. Adds `do-not-merge/release-note-label-needed` if missing one of:
224+
- `release-note` - User-facing changes
225+
- `release-note-action-required` - Requires action from users
226+
- `release-note-none` - No user-facing changes
227+
228+
**NEW**: Also supports comment commands for easier label management:
229+
- **Commands**: `/release-note`, `/release-note-action-required`, `/release-note-none`
230+
- **Permissions**: ⚠️ **PR author ONLY** (matches Prow's release-note plugin behavior)
231+
- **Rationale**: Only the PR author can set release note labels to ensure they take responsibility for documenting their changes
232+
- **Features**: Automatically removes other release-note labels when applying a new one
233+
234+
### [`pr_needs-rebase-label.yaml`](workflows/pr_needs-rebase-label.yaml)
235+
Automatically detects merge conflicts and adds/removes the `needs-rebase` label when conflicts are present.
236+
237+
### [`pr_merge-readiness.yaml`](workflows/pr_merge-readiness.yaml)
238+
Provides a required status check that verifies both `lgtm` and `approved` labels are present and no blocking labels exist.
239+
240+
## Migration from Prow
241+
242+
This system replaces the Prow Tide configuration with native GitHub functionality:
243+
244+
| Prow Tide | GitHub Workflows |
245+
|-----------|------------------|
246+
| `/lgtm` command | `/lgtm` command (via `pr_approval-labels.yaml`) |
247+
| `/approve` command | `/approve` command (via `pr_approval-labels.yaml`) |
248+
| `/hold` command | `/hold` command (via `pr_hold-label.yaml`) |
249+
| Release note plugin | Release note workflow (via `pr_release-notes-label.yaml`) with `/release-note-*` commands |
250+
| Tide merge pool | GitHub Merge Queue |
251+
| Tide status contexts | Merge Readiness Check |
252+
| Automatic merging | Auto-merge + Merge Queue |
253+
254+
### Key Differences from Prow Tide
255+
256+
#### Architecture
257+
- **Prow Tide**: Centralized service running on Kubernetes cluster, polls GitHub API for PRs matching criteria
258+
- **GitHub Workflows**: Distributed event-driven workflows, triggered by GitHub webhooks on PR events
259+
- **Result**: Lower latency (immediate response vs polling), no infrastructure to maintain
260+
261+
#### Label Management
262+
- **Prow Tide**: Plugins (lgtm, approve, hold, wip) managed by central Prow plugins
263+
- **GitHub Workflows**: Individual workflows handle each command independently
264+
- **Result**: More modular, easier to customize individual behaviors
265+
266+
#### Merge Process
267+
- **Prow Tide**:
268+
- Batches multiple PRs together for testing
269+
- Maintains merge pool with sync loop (default: 2m)
270+
- Tests PRs together, merges if batch passes
271+
- Bisects on failure to find culprit
272+
- **GitHub Merge Queue**:
273+
- Tests each PR individually or in configurable groups
274+
- Queue-based approach with configurable merge strategies
275+
- Native GitHub UI for queue visibility
276+
- No separate infrastructure needed
277+
- **Result**: Similar reliability, simpler setup, better UI
278+
279+
#### Permission Model
280+
- **Prow Tide**: Uses GitHub team membership and OWNERS files
281+
- **GitHub Workflows**: Uses GitHub's native repository permissions (read/write/admin)
282+
- **Result**: More straightforward, one permission system to manage
283+
284+
#### Status Checks
285+
- **Prow Tide**: Multiple required contexts, complex configuration
286+
- **GitHub Workflows**: Single "Merge Readiness Check" workflow
287+
- **Result**: Simpler to understand, single source of truth
288+
289+
#### Commands
290+
- **Prow Tide**: Fixed set of commands defined in plugins config
291+
- **GitHub Workflows**: Flexible, can add new commands easily by creating new workflows
292+
- **Result**: More extensible and customizable
293+
294+
#### What's the Same
295+
`/lgtm` and `/approve` commands work identically
296+
`/hold` blocks merging
297+
`do-not-merge/*` labels prevent merging
298+
✅ Automatic WIP detection
299+
✅ Release note label enforcement
300+
✅ Merge conflict detection
301+
✅ Permission-based access control
302+
303+
#### What's Different
304+
⚠️ **No batch merging** - GitHub merge queue tests PRs individually or in smaller groups
305+
⚠️ **No OWNERS file** - Uses GitHub repository permissions instead
306+
⚠️ **Different UI** - GitHub PR UI instead of Prow dashboard
307+
⚠️ **Faster response** - Event-driven instead of polling (2m sync period)
308+
⚠️ **Simpler setup** - No Prow infrastructure needed
309+
310+
#### Migration Considerations
311+
- **OWNERS files**: If you rely on OWNERS files for approval, you'll need to migrate to GitHub CODEOWNERS
312+
- **Batch testing**: If you need to test multiple PRs together, configure merge queue groups
313+
- **Custom plugins**: Any custom Prow plugins need to be reimplemented as GitHub workflows
314+
- **Tide configuration**: Context requirements → Branch protection rules
315+
- **Bot accounts**: Replace Prow bot token with GitHub Actions bot or app
316+
317+
## Troubleshooting
318+
319+
### Commands not working
320+
- Verify you have write access to the repository
321+
- Ensure the command is at the start of the comment
322+
- Check workflow run logs in the Actions tab
323+
324+
### Merge Readiness Check failing
325+
- Verify both `lgtm` and `approved` labels are present
326+
- Check the workflow logs for detailed status
327+
328+
### Auto-merge not triggering
329+
- Ensure merge queue is enabled in repository settings
330+
- Verify all required status checks are passing
331+
- Check that auto-merge is enabled on the PR

.github/workflows/ci.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
3232
unit-tests:
3333
name: Unit Tests
34-
needs: [build]
3534
runs-on: ubuntu-latest
3635
steps:
3736
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -44,7 +43,6 @@ jobs:
4443
4544
linting:
4645
name: Linting
47-
needs: [build]
4846
runs-on: ubuntu-latest
4947
steps:
5048
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -73,7 +71,6 @@ jobs:
7371

7472
check-licenses:
7573
name: License Check
76-
needs: [build]
7774
runs-on: ubuntu-latest
7875
steps:
7976
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -87,7 +84,6 @@ jobs:
8784
8885
ko-resolve:
8986
name: Ko Resolve (Multi-arch)
90-
needs: [build]
9187
runs-on: ubuntu-latest
9288
steps:
9389
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

0 commit comments

Comments
 (0)