Skip to content

Commit b171e67

Browse files
committed
.github/workflows: configure some workflows to run as part of the merge_queue
- Add merge_group for event triggering - Add a minimal parameter to the e2e-matrix so that we run only one set of e2e tests on merge. - Update DEVELOPMENT.md to explain the mergue queue implementation. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
1 parent 68bb12e commit b171e67

5 files changed

Lines changed: 81 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: ci
22

3-
on: [pull_request]
3+
on:
4+
pull_request:
5+
merge_group:
46

57
concurrency:
68
group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }}
@@ -147,3 +149,5 @@ jobs:
147149
e2e-tests:
148150
needs: [build]
149151
uses: ./.github/workflows/e2e-matrix.yml
152+
with:
153+
minimal: ${{ github.event_name == 'merge_group' }}

.github/workflows/dependency-review.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#
88
# Source repository: https://github.com/actions/dependency-review-action
99
name: 'Dependency Review'
10-
on: [pull_request]
10+
on:
11+
pull_request:
12+
merge_group:
1113

1214
permissions:
1315
contents: read

.github/workflows/e2e-matrix.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: Tekton Integration
22
# Adapted from https://github.com/mattmoor/mink/blob/master/.github/workflows/minkind.yaml
33

4-
on: [workflow_call]
4+
on:
5+
workflow_call:
6+
inputs:
7+
minimal:
8+
description: 'Run minimal matrix (aka only one job)'
9+
required: false
10+
type: boolean
11+
default: false
512

613
defaults:
714
run:
@@ -36,7 +43,7 @@ jobs:
3643
- k8s-name: k8s-latest
3744
k8s-version: v1.34.x
3845

39-
# Limit arm64: only run k8s-latest on arm64 (alpha and beta), skip oldest on arm64
46+
# Limit arm64: only run k8s-latest on arm64 (stable), skip oldest on arm64
4047
exclude:
4148
- k8s-name: k8s-oldest
4249
os: ubuntu-24.04-arm
@@ -53,7 +60,9 @@ jobs:
5360

5461
steps:
5562
- name: Free disk space
56-
if: ${{ matrix.os != 'ubuntu-24.04-arm' }}
63+
if: |
64+
matrix.os != 'ubuntu-24.04-arm' &&
65+
(!inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable'))
5766
run: |
5867
echo "--- Disk space before cleanup ---"
5968
df -h
@@ -65,12 +74,16 @@ jobs:
6574
echo "--- Disk space after cleanup ---"
6675
df -h
6776
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
77+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
6878
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
79+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
6980
with:
7081
go-version-file: "go.mod"
7182
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
83+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
7284

7385
- name: Install Dependencies
86+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
7487
working-directory: ./
7588
run: |
7689
echo '::group:: install go-junit-report'
@@ -84,6 +97,7 @@ jobs:
8497
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
8598
8699
- name: Run tests
100+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
87101
run: |
88102
# This is a hack to make sure binary in /bin from the base image are not picked by default
89103
# On ubuntu-arm, there is a /bin/go that shadows the one setup-go installs
@@ -98,6 +112,7 @@ jobs:
98112
--e2e-env ./test/e2e-tests-kind-${{ matrix.feature-flags }}.env
99113
100114
- name: Upload test results
115+
if: ${{ !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable') }}
101116
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
102117
with:
103118
name: ${{ matrix.k8s-version }}-${{ matrix.feature-flags }}-${{ matrix.os }}

.github/workflows/go-coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ permissions:
66
on:
77
pull_request:
88
branches: ["main"]
9+
merge_group:
910
push:
1011
branches: ["main"]
1112
# run at least once every 2 months to prevent the coverage artifact from expiring

DEVELOPMENT.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,60 @@ as follows.
291291
292292
---
293293
294+
## Pull Request Merge Queue
295+
296+
This repository uses GitHub's merge queue to ensure the `main` branch remains stable and free from integration conflicts. The merge queue automatically validates that approved pull requests can be merged cleanly with the latest version of `main` before allowing them to land.
297+
298+
### How It Works
299+
300+
When your pull request is approved and all required checks pass:
301+
302+
1. **Add to Queue**: An approver adds your PR to the merge queue (either manually or automatically based on labels/approvals)
303+
2. **Temporary Merge**: GitHub creates a temporary branch (`gh-readonly-queue/main/pr-{number}-{sha}`) that merges your PR with the latest `main`
304+
3. **Validation**: Required CI checks run on this merged state to verify compatibility
305+
4. **Automatic Merge**: If all checks pass, your PR is automatically merged to `main`
306+
5. **Failure Handling**: If checks fail on the merged state, your PR is removed from the queue and you'll need to rebase/fix conflicts
307+
308+
### CI Behavior in Merge Queue
309+
310+
To keep the merge queue fast and efficient, the CI matrix is optimized differently for merge queue builds versus regular PR builds:
311+
312+
**Regular Pull Request Builds:**
313+
- Full e2e test matrix: 18 configurations
314+
- 2 architectures (amd64, arm64)
315+
- 2 Kubernetes versions (1.28, 1.34)
316+
- 3 feature flag sets (stable, beta, alpha)
317+
- Comprehensive validation before approval
318+
319+
**Merge Queue Builds:**
320+
- Minimal e2e test matrix: 1 configuration
321+
- Single architecture: ubuntu-latest (amd64)
322+
- Latest Kubernetes: 1.34
323+
- Stable feature flags only
324+
- Faster validation focused on integration conflicts
325+
- Full matrix already validated during PR review
326+
327+
This optimization significantly reduces merge queue time while maintaining safety, since your PR has already passed the full 18-configuration test matrix during review.
328+
329+
### What You Need to Know
330+
331+
- **PR reviews unchanged**: Continue developing and testing PRs as usual - all checks must pass before your PR can enter the queue
332+
- **Automatic process**: Once approved, the merge queue handles merging automatically
333+
- **Stay up-to-date**: Keep your PR rebased on `main` to minimize queue failures
334+
- **Queue failures**: If your PR fails in the queue, check for:
335+
- Merge conflicts with recent changes to `main`
336+
- Integration issues with other recently merged PRs
337+
- Flaky tests (less common with minimal matrix)
338+
339+
### Benefits
340+
341+
- **Never break main**: Changes are only merged if they work with the latest code
342+
- **No merge conflicts**: Incompatible changes are detected before landing
343+
- **Reduced CI load**: Optimized test matrix for queue builds saves resources
344+
- **Higher velocity**: Automated merging eliminates manual merge bottlenecks
345+
346+
---
347+
294348
## Building and deploying
295349
296350
### Setup a Kubernetes cluster

0 commit comments

Comments
 (0)