Skip to content

Commit e8c5ba2

Browse files
committed
BPF CI: Switch to Debian-based kernel builders
Use a custom Debian-base docker image for kernel build jobs (kernel-patches/runner#94). Bump libbpf/ci actions to v4 (libbpf/ci#210). Other nits: - set CROSS_COMPILE only for s390x - simplify Linux source download - remove setup docker/qemu logic - in gcc-bpf, install github cli on demand Signed-off-by: Ihor Solodrai <[email protected]>
1 parent cbe25c3 commit e8c5ba2

File tree

8 files changed

+51
-95
lines changed

8 files changed

+51
-95
lines changed

.github/scripts/download-gcc-bpf.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ INSTALL_DIR=$(realpath $2)
77

88
cd /tmp
99

10+
if ! command -v gh &> /dev/null; then
11+
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
12+
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
13+
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
14+
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
15+
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
16+
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
17+
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
18+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
19+
&& sudo apt update \
20+
&& sudo apt install gh -y
21+
fi
22+
1023
tag=$(gh release list -L 1 -R ${GCC_BPF_RELEASE_GH_REPO} --json tagName -q .[].tagName)
1124
if [[ -z "$tag" ]]; then
1225
echo "Could not find latest GCC BPF release at ${GCC_BPF_RELEASE_GH_REPO}"
@@ -27,4 +40,3 @@ rm -rf $INSTALL_DIR
2740
mv -v $dir $INSTALL_DIR
2841

2942
cd -
30-

.github/workflows/ai-code-review.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222

2323
- name: Download Linux source tree
24-
uses: libbpf/ci/get-linux-source@v3
24+
uses: libbpf/ci/get-linux-source@v4
2525
with:
2626
repo: ${{ github.event.pull_request.head.repo.clone_url }}
2727
rev: ${{ github.event.pull_request.head.sha }}
@@ -78,7 +78,7 @@ jobs:
7878
cp ci/claude/settings.json ~/.claude/settings.json
7979
8080
- name: Download Linux source tree
81-
uses: libbpf/ci/get-linux-source@v3
81+
uses: libbpf/ci/get-linux-source@v4
8282
with:
8383
repo: ${{ github.event.pull_request.head.repo.clone_url }}
8484
rev: ${{ github.event.pull_request.head.sha }}

.github/workflows/gcc-bpf.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ on:
2828
jobs:
2929
test:
3030
name: GCC BPF
31-
runs-on: >-
32-
${{
33-
contains(fromJSON(inputs.runs_on), 'codebuild')
34-
&& format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt)
35-
|| fromJSON(inputs.runs_on)
36-
}}
31+
runs-on:
32+
- ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
33+
- image:custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64
3734
env:
3835
ARCH: ${{ inputs.arch }}
3936
BPF_NEXT_BASE_BRANCH: 'master'
@@ -52,7 +49,7 @@ jobs:
5249
5350
- if: ${{ inputs.download_sources }}
5451
name: Download bpf-next tree
55-
uses: libbpf/ci/get-linux-source@v3
52+
uses: libbpf/ci/get-linux-source@v4
5653
with:
5754
dest: ${{ env.REPO_ROOT }}
5855
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
@@ -63,7 +60,7 @@ jobs:
6360
with:
6461
path: 'src'
6562

66-
- uses: libbpf/ci/patch-kernel@v3
63+
- uses: libbpf/ci/patch-kernel@v4
6764
with:
6865
patches-root: '${{ github.workspace }}/ci/diffs'
6966
repo-root: ${{ env.REPO_ROOT }}
@@ -78,7 +75,7 @@ jobs:
7875
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -
7976

8077
- name: Setup build environment
81-
uses: libbpf/ci/setup-build-env@v3
78+
uses: libbpf/ci/setup-build-env@v4
8279
with:
8380
arch: ${{ inputs.arch }}
8481
gcc-version: ${{ inputs.gcc_version }}
@@ -91,7 +88,7 @@ jobs:
9188
run: .github/scripts/download-gcc-bpf.sh ${{ env.GCC_BPF_RELEASE_REPO }} ${{ env.GCC_BPF_INSTALL_DIR }}
9289

9390
- name: Build selftests/bpf/test_progs-bpf_gcc
94-
uses: libbpf/ci/build-selftests@v3
91+
uses: libbpf/ci/build-selftests@v4
9592
env:
9693
BPF_GCC: ${{ env.GCC_BPF_INSTALL_DIR }}
9794
MAX_MAKE_JOBS: 32

.github/workflows/kernel-build.yml

Lines changed: 24 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -46,44 +46,31 @@ on:
4646
jobs:
4747
build:
4848
name: build kernel and selftests ${{ inputs.release && '-O2' || '' }}
49-
# To run on CodeBuild, runs-on value must correspond to the AWS
50-
# CodeBuild project associated with the kernel-patches webhook
51-
# However matrix.py passes just a 'codebuild' string
52-
runs-on: >-
53-
${{
54-
contains(fromJSON(inputs.runs_on), 'codebuild')
55-
&& format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt)
56-
|| fromJSON(inputs.runs_on)
57-
}}
49+
runs-on:
50+
- ${{ github.repository == 'kernel-patches/bpf-rc' && 'ubuntu-latest'
51+
|| format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
52+
# AWS docs about image override: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-action-runners-update-labels.html
53+
- image:${{ inputs.arch == 'aarch64' && 'custom-arm-ghcr.io/kernel-patches/runner:kbuilder-debian-aarch64'
54+
|| 'custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64' }}
5855
env:
5956
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
60-
BPF_NEXT_BASE_BRANCH: 'master'
6157
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
62-
CROSS_COMPILE: ${{ inputs.arch != 'x86_64' && 'true' || '' }}
58+
CROSS_COMPILE: ${{ inputs.arch == 's390x' && 'true' || '' }}
6359
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
6460
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
6561
KERNEL: ${{ inputs.kernel }}
6662
KERNEL_ROOT: ${{ github.workspace }}
63+
KERNEL_ORIGIN: ${{ github.repository == 'kernel-patches/bpf-rc' && 'https://github.com/kernel-patches/bpf-rc.git'
64+
|| 'https://github.com/kernel-patches/bpf.git'
65+
}}
66+
KERNEL_REVISION: ${{ inputs.download_sources && 'bpf-next' || github.sha }}
6767
REFERENCE_REPO_PATH: /libbpfci/mirrors/linux
6868
REPO_PATH: ""
6969
REPO_ROOT: ${{ github.workspace }}
70-
RUNNER_TYPE: ${{ contains(fromJSON(inputs.runs_on), 'codebuild') && 'codebuild' || 'default' }}
70+
RUNNER_TYPE: codebuild
7171
steps:
7272

73-
# git version 2.43.0 (current Ubuntu 24 installation)
74-
# does not support git clone --revision option
75-
# so make sure latest git is installed
76-
- name: Install latest git
77-
shell: bash
78-
run: |
79-
sudo apt-get update
80-
sudo apt-get install -y software-properties-common
81-
sudo add-apt-repository -y ppa:git-core/ppa
82-
sudo apt-get update
83-
sudo apt-get install -y git
84-
git --version
85-
86-
- uses: actions/checkout@v4
73+
- uses: actions/checkout@v6
8774
with:
8875
sparse-checkout: |
8976
.github
@@ -93,42 +80,14 @@ jobs:
9380
shell: bash
9481
run: .github/scripts/tmpfsify-workspace.sh
9582

96-
- if: ${{ ! inputs.download_sources }}
97-
name: git clone ${{ github.repository }}@${{ github.sha }}
98-
shell: bash
99-
run: |
100-
if [ -d "${{ env.REFERENCE_REPO_PATH }}" ]; then
101-
git clone \
102-
--revision ${{ github.sha }} \
103-
--reference-if-able ${{ env.REFERENCE_REPO_PATH }} \
104-
https://github.com/${{ github.repository }}.git .kernel
105-
else
106-
git clone \
107-
--revision ${{ github.sha }} \
108-
--depth ${{ inputs.download_sources && 1 || env.BPF_NEXT_FETCH_DEPTH }} \
109-
https://github.com/${{ github.repository }}.git .kernel
110-
fi
111-
112-
- if: ${{ inputs.download_sources }}
113-
name: Download bpf-next tree
83+
- name: Download bpf-next tree @ ${{ env.KERNEL_REVISION }}
84+
uses: libbpf/ci/get-linux-source@v4
11485
env:
11586
FETCH_DEPTH: ${{ env.BPF_NEXT_FETCH_DEPTH }}
116-
uses: libbpf/ci/get-linux-source@v3
11787
with:
11888
dest: '.kernel'
119-
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
120-
121-
- uses: libbpf/ci/prepare-incremental-build@v3
122-
with:
123-
repo-root: '.kernel'
124-
base-branch: >-
125-
${{ inputs.download_sources && env.BPF_NEXT_BASE_BRANCH
126-
|| github.event_name == 'pull_request' && github.base_ref
127-
|| github.ref_name
128-
}}
129-
arch: ${{ inputs.arch }}
130-
toolchain_full: ${{ inputs.toolchain_full }}
131-
kbuild-output: ${{ env.KBUILD_OUTPUT }}
89+
repo: ${{ env.KERNEL_ORIGIN }}
90+
rev: ${{ env.KERNEL_REVISION }}
13291

13392
- name: Move linux source in place
13493
shell: bash
@@ -139,33 +98,21 @@ jobs:
13998
cd ..
14099
rmdir .kernel
141100
142-
- uses: libbpf/ci/patch-kernel@v3
101+
- uses: libbpf/ci/patch-kernel@v4
143102
with:
144103
patches-root: '${{ github.workspace }}/ci/diffs'
145104
repo-root: ${{ env.REPO_ROOT }}
146105

147106
- name: Setup build environment
148-
uses: libbpf/ci/setup-build-env@v3
107+
uses: libbpf/ci/setup-build-env@v4
149108
with:
150109
arch: ${{ inputs.arch }}
151110
gcc-version: ${{ inputs.gcc_version }}
152111
llvm-version: ${{ inputs.llvm_version }}
153112
pahole: master
154113

155-
# We have to setup qemu+binfmt in order to enable cross-compation of selftests.
156-
# During selftests build, freshly built bpftool is executed.
157-
# On self-hosted bare-metal hosts binfmt is pre-configured.
158-
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
159-
name: Set up docker
160-
uses: docker/setup-docker-action@v4
161-
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
162-
name: Setup binfmt and qemu
163-
uses: docker/setup-qemu-action@v3
164-
with:
165-
image: tonistiigi/binfmt:qemu-v9.2.0
166-
167114
- name: Build kernel image
168-
uses: libbpf/ci/build-linux@v3
115+
uses: libbpf/ci/build-linux@v4
169116
with:
170117
arch: ${{ inputs.arch }}
171118
toolchain: ${{ inputs.toolchain }}
@@ -174,7 +121,7 @@ jobs:
174121
llvm-version: ${{ inputs.llvm_version }}
175122

176123
- name: Build selftests/bpf
177-
uses: libbpf/ci/build-selftests@v3
124+
uses: libbpf/ci/build-selftests@v4
178125
env:
179126
MAX_MAKE_JOBS: 32
180127
RELEASE: ${{ inputs.release && '1' || '' }}
@@ -186,7 +133,7 @@ jobs:
186133

187134
- if: ${{ env.BUILD_SCHED_EXT_SELFTESTS }}
188135
name: Build selftests/sched_ext
189-
uses: libbpf/ci/build-scx-selftests@v3
136+
uses: libbpf/ci/build-scx-selftests@v4
190137
with:
191138
kbuild-output: ${{ env.KBUILD_OUTPUT }}
192139
repo-root: ${{ env.REPO_ROOT }}
@@ -197,7 +144,7 @@ jobs:
197144

198145
- if: ${{ github.event_name != 'push' }}
199146
name: Build samples
200-
uses: libbpf/ci/build-samples@v3
147+
uses: libbpf/ci/build-samples@v4
201148
with:
202149
arch: ${{ inputs.arch }}
203150
toolchain: ${{ inputs.toolchain }}
@@ -206,7 +153,7 @@ jobs:
206153
llvm-version: ${{ inputs.llvm_version }}
207154
- name: Tar artifacts
208155
id: tar-artifacts
209-
uses: libbpf/ci/tar-artifacts@v3
156+
uses: libbpf/ci/tar-artifacts@v4
210157
env:
211158
ARCHIVE_BPF_SELFTESTS: 'true'
212159
ARCHIVE_MAKE_HELPERS: 'true'

.github/workflows/kernel-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -
6666

6767
- name: Run selftests
68-
uses: libbpf/ci/run-vmtest@v3
68+
uses: libbpf/ci/run-vmtest@v4
6969
# https://github.com/actions/runner/issues/1483#issuecomment-1031671517
7070
# booleans are weird in GH.
7171
continue-on-error: ${{ fromJSON(env.CONTINUE_ON_ERROR) }}

.github/workflows/veristat-kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: zstd -d -T0 vmlinux-${{ env.ARCH_AND_TOOL }}.tar.zst --stdout | tar -xf -
5151

5252
- name: Run veristat
53-
uses: libbpf/ci/run-vmtest@v3
53+
uses: libbpf/ci/run-vmtest@v4
5454
with:
5555
arch: x86_64
5656
vmlinuz: '${{ github.workspace }}/vmlinuz'

.github/workflows/veristat-meta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
7272

7373
- name: Run veristat
74-
uses: libbpf/ci/run-vmtest@v3
74+
uses: libbpf/ci/run-vmtest@v4
7575
with:
7676
arch: x86_64
7777
vmlinuz: '${{ github.workspace }}/vmlinuz'

.github/workflows/veristat-scx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
sparse-checkout: |
3636
.github
3737
ci
38-
- uses: libbpf/ci/build-scx-scheds@v3
38+
- uses: libbpf/ci/build-scx-scheds@v4
3939
with:
4040
output-dir: ${{ env.SCX_BUILD_OUTPUT }}
4141
- name: Collect scx progs
@@ -88,7 +88,7 @@ jobs:
8888
path: ${{ env.SCX_PROGS }}
8989

9090
- name: Run veristat
91-
uses: libbpf/ci/run-vmtest@v3
91+
uses: libbpf/ci/run-vmtest@v4
9292
with:
9393
arch: x86_64
9494
vmlinuz: '${{ github.workspace }}/vmlinuz'

0 commit comments

Comments
 (0)