Skip to content

eBPF-based security platform

ci: run only the builds and quick checks in the merge queue

Martynas Pumputis1587f0e45591
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 829c485f..835c5f0d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,6 +5,9 @@ on:
branches:
- main
pull_request:
+ # The merge queue builds with gcc and clang alone, which is where a
+ # change landing first most often breaks another. The pull request and
+ # the push to main run every job.
merge_group:
types: [checks_requested]
@@ -67,8 +70,10 @@ jobs:
sh .github/scripts/check-static-target.sh \
tools/quote-check/shirudo-quote-check
+ # Skipped in the merge queue, and scan-build with it.
btf:
name: bpf-next BTF
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
timeout-minutes: 30
@@ -147,9 +152,14 @@ jobs:
path: build/scan-build
if-no-files-found: ignore
+ # A matrix job skipped as a whole reports one check, under none of its
+ # entries' names, and the merge queue waits for each of those. In the
+ # queue the job runs instead, without the BTF and with every step
+ # skipped.
arch:
name: ${{ matrix.arch }}
needs: btf
+ if: ${{ !cancelled() && (needs.btf.result == 'success' || github.event_name == 'merge_group') }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
@@ -166,22 +176,25 @@ jobs:
steps:
- name: Check out repository
+ if: github.event_name != 'merge_group'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download the kernel BTF
+ if: github.event_name != 'merge_group'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: bpf-next-btf
path: build
- name: Set up QEMU user emulation
- if: matrix.arch == 'riscv64'
+ if: github.event_name != 'merge_group' && matrix.arch == 'riscv64'
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
with:
image: tonistiigi/binfmt:qemu-v10.2.3@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0
platforms: riscv64
- name: Build and run the unit tests on Debian testing
+ if: github.event_name != 'merge_group'
env:
ARCH: ${{ matrix.arch }}
run: >-
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index b6b6135d..dbc679ee 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -5,6 +5,8 @@ on:
branches:
- main
pull_request:
+ # The merge queue leaves sparse and Coccinelle to the pull request and
+ # the push to main: a change landing first rarely alters what they find.
merge_group:
types: [checks_requested]
@@ -59,6 +61,7 @@ jobs:
sparse:
name: Sparse
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
@@ -87,6 +90,7 @@ jobs:
coccinelle:
name: Coccinelle
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index 04076d86..b8f54781 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -8,6 +8,9 @@ on:
- '*'
- '!test-kernel-*'
pull_request:
+ # The merge queue builds no packages: deb and rpm-target skip there, and
+ # the jobs that need them with them. The pull request and the push to
+ # main build them all.
merge_group:
types: [checks_requested]
workflow_dispatch:
@@ -31,6 +34,7 @@ concurrency:
jobs:
deb:
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
timeout-minutes: 25
@@ -280,6 +284,7 @@ jobs:
retention-days: 14
rpm-target:
+ if: github.event_name != 'merge_group'
outputs:
version: ${{ steps.build-version.outputs.version }}
runs-on: ubuntu-latest
@@ -370,7 +375,7 @@ jobs:
if-no-files-found: error
kernel-obs-preview:
- if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
+ if: github.event_name == 'pull_request'
needs: [deb, rpm-target]
runs-on: ubuntu-latest
timeout-minutes: 30
@@ -384,8 +389,8 @@ jobs:
uses: ./.github/actions/kernel-obs
with:
mode: preview
- version: 0.1.${{ github.run_number }}-${{ github.event_name == 'pull_request' && format('pr.{0}', github.event.pull_request.number) || 'merge-group' }}
- artifact-name: ${{ github.event_name == 'pull_request' && format('kernel-obs-preview-pr-{0}', github.event.pull_request.number) || format('kernel-obs-preview-merge-group-{0}', github.event.merge_group.head_sha) }}
+ version: 0.1.${{ github.run_number }}-pr.${{ github.event.pull_request.number }}
+ artifact-name: kernel-obs-preview-pr-${{ github.event.pull_request.number }}
kernel-obs-publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 3a1b1950..1c2c442e 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -5,6 +5,9 @@ on:
branches:
- main
pull_request:
+ # The merge queue runs none of these tests: the pull request ran them on
+ # its changes and the push to main runs them on the result. Its run only
+ # passes the checks the queue requires.
merge_group:
types: [checks_requested]
workflow_dispatch:
@@ -30,6 +33,7 @@ concurrency:
jobs:
kernel-plan:
name: Select the test kernel
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
outputs:
build: ${{ steps.select.outputs.build }}
@@ -43,7 +47,7 @@ jobs:
- name: Check whether the kernel inputs changed
id: select
env:
- BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
+ BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
KERNEL_RUN_ID: ${{ inputs.kernel_run_id }}
run: sh .github/scripts/select-test-kernel.sh
@@ -52,6 +56,10 @@ jobs:
if: needs.kernel-plan.outputs.build == 'true'
uses: ./.github/workflows/build-kernel-packages.yml
+ # A matrix job skipped as a whole reports one check, under none of its
+ # entries' names, and the merge queue waits for each of those. In the
+ # queue the job runs instead with every step skipped; the uploads and
+ # saves that follow the tests find nothing to keep.
tests:
needs: [kernel-plan, kernel-build]
if: ${{ !cancelled() }}
@@ -96,22 +104,24 @@ jobs:
steps:
- name: Require successful kernel preparation
if: >-
- needs.kernel-plan.result != 'success' ||
- (needs.kernel-plan.outputs.build == 'true' && needs.kernel-build.result != 'success')
+ github.event_name != 'merge_group' &&
+ (needs.kernel-plan.result != 'success' ||
+ (needs.kernel-plan.outputs.build == 'true' && needs.kernel-build.result != 'success'))
run: /usr/bin/false
- name: Check out repository
+ if: github.event_name != 'merge_group'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download the kernel built for this run
- if: needs.kernel-plan.outputs.build == 'true'
+ if: github.event_name != 'merge_group' && needs.kernel-plan.outputs.build == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: kernel-packages-x86-64-ci
path: build/kernel-ci-artifact
- name: Download the pinned or selected kernel
- if: needs.kernel-plan.outputs.build != 'true'
+ if: github.event_name != 'merge_group' && needs.kernel-plan.outputs.build != 'true'
env:
GH_TOKEN: ${{ github.token }}
KERNEL_RUN_ID: ${{ inputs.kernel_run_id }}
@@ -119,7 +129,7 @@ jobs:
run: testing/vm/kernel-artifact.sh download
- name: Restore the static target dependencies
- if: matrix.vm == '1'
+ if: github.event_name != 'merge_group' && matrix.vm == '1'
id: target-deps
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -127,6 +137,7 @@ jobs:
key: target-deps-${{ hashFiles('Makefile.target-deps') }}
- name: Restore the host OpenSSL toolchain
+ if: github.event_name != 'merge_group'
id: host-openssl
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -134,6 +145,7 @@ jobs:
key: host-openssl-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/scripts/vm-toolchain.sh') }}
- name: Restore the host libtpms toolchain
+ if: github.event_name != 'merge_group'
id: host-libtpms
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -141,7 +153,7 @@ jobs:
key: host-libtpms-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/scripts/vm-toolchain.sh', '.github/scripts/install-libtpms.sh') }}
- name: Restore the VM images
- if: matrix.vm == '1'
+ if: github.event_name != 'merge_group' && matrix.vm == '1'
id: images
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -149,13 +161,14 @@ jobs:
key: test-vm-runtime-and-operator-${{ hashFiles('testing/vm/runtime-packages', 'testing/vm/operator-packages', 'testing/vm/prepare-runtime.sh', 'testing/vm/build-bundle.sh', 'testing/vm/arch.sh', '.github/scripts/install-clang.sh', '.github/scripts/install-static-libcrypto-deps.sh', 'testing/container/Containerfile', 'testing/container/packages', 'Makefile.target-deps') }}
- name: Prepare the test environment
+ if: github.event_name != 'merge_group'
id: setup
env:
KERNEL_CI_ARTIFACT_DIR: ${{ format('{0}/build/kernel-ci-artifact', github.workspace) }}
run: .github/scripts/tests.sh setup
- name: Run unit tests
- if: matrix.suite == 'unit' || matrix.suite == 'host'
+ if: github.event_name != 'merge_group' && (matrix.suite == 'unit' || matrix.suite == 'host')
env:
SHIRUDO_SKIP_TREE_CHECKS: >-
${{ (github.event_name == 'pull_request' ||
@@ -163,11 +176,11 @@ jobs:
run: .github/scripts/tests.sh run unit
- name: Run host functional tests
- if: ${{ !cancelled() && steps.setup.outcome == 'success' && matrix.suite == 'host' }}
+ if: ${{ github.event_name != 'merge_group' && !cancelled() && steps.setup.outcome == 'success' && matrix.suite == 'host' }}
run: .github/scripts/tests.sh run functional
- name: Run selected test suite
- if: matrix.vm == '1'
+ if: github.event_name != 'merge_group' && matrix.vm == '1'
id: suite
env:
TEST_SUITE: ${{ matrix.suite }}
@@ -217,6 +230,7 @@ jobs:
backend:
name: Backend SQL tests
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
@@ -228,6 +242,7 @@ jobs:
xtop:
name: xtop tests
+ if: github.event_name != 'merge_group'
runs-on: ubuntu-latest
steps:
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index 8904465e..f9300988 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -58,6 +58,15 @@ The functional shards run upatch, tamperproof, the BPM families, and
the remaining families. The arm64 host job runs unit, script, and host
functional tests together.
+The merge queue tests a pull request again on top of the changes that
+land before it, and runs only what such a change most often breaks: the
+gcc and clang jobs of ``Build`` with their unit tests, ``Build every
+commit``, the documentation, the sign-offs, and the checkpatch, SPDX,
+ShellCheck and unused-function jobs of ``Lint``. The ``CI suite``, the
+arm64, riscv64 and scan-build jobs, sparse, Coccinelle and the packages
+run on the pull request and on every push to ``main``. In the merge queue
+their jobs pass without running.
+
On pull requests and pushes to ``main``, Lint runs the full-tree Coccinelle
and unused-function checks. The CI suite, coverage, and sanitizer jobs still
run the self-tests for both scripts. Local, manually dispatched, and sanitizer