Skip to content

Commit 2119ee8

Browse files
committed
kernel-build: implement autoscaling
Run kernel build jobs on the runners provided by AWS CodeBuild service: AWS-hosted environment running our custom docker container [1] on demand. This will help handling demand spikes, such as when upstream is merged into kernel-patches/bpf and workflows are triggered for each pending patch. [1] https://github.com/kernel-patches/runner/blob/main/Dockerfile Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
1 parent 462c4f1 commit 2119ee8

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/kernel-build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
arch: ${{ inputs.arch }}
7979
toolchain_full: ${{ inputs.toolchain_full }}
8080
toolchain: ${{ inputs.toolchain }}
81-
runs_on: ${{ inputs.runs_on }}
81+
runs_on: ${{ inputs.build_runs_on }}
8282
llvm-version: ${{ inputs.llvm-version }}
8383
kernel: ${{ inputs.kernel }}
8484
download_sources: ${{ inputs.download_sources }}

.github/workflows/kernel-build.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,26 @@ on:
4242
jobs:
4343
build:
4444
name: build for ${{ inputs.arch }} with ${{ inputs.toolchain_full }}${{ inputs.release && '-O2' || '' }}
45-
runs-on: ${{ fromJSON(inputs.runs_on) }}
46-
timeout-minutes: 100
45+
# To run on CodeBuild, runs-on value must correspond to the AWS
46+
# CodeBuild project associated with the kernel-patches webhook
47+
runs-on: >-
48+
${{
49+
github.repository_owner == 'kernel-patches'
50+
&& format('codebuild-gha-runner-poc-{0}-{1}', github.run_id, github.run_attempt)
51+
|| fromJSON(inputs.runs_on)
52+
}}
4753
env:
4854
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
4955
BPF_NEXT_BASE_BRANCH: 'master'
5056
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
57+
CROSS_COMPILE: ${{ inputs.arch != 'x86_64' && 'true' || '' }}
5158
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
5259
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
5360
KERNEL: ${{ inputs.kernel }}
5461
KERNEL_ROOT: ${{ github.workspace }}
5562
REPO_PATH: ""
5663
REPO_ROOT: ${{ github.workspace }}
64+
RUNNER_TYPE: ${{ github.repository_owner == 'kernel-patches' && 'codebuild' || 'default' }}
5765
steps:
5866
- uses: actions/checkout@v4
5967
with:
@@ -98,6 +106,18 @@ jobs:
98106
llvm-version: ${{ inputs.llvm-version }}
99107
pahole: master
100108

109+
# We have to setup qemu+binfmt in order to enable cross-compation of selftests.
110+
# During selftests build, freshly built bpftool is executed.
111+
# On self-hosted bare-metal hosts binfmt is pre-configured.
112+
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
113+
name: Set up docker
114+
uses: docker/setup-docker-action@v4
115+
- if: ${{ env.RUNNER_TYPE == 'codebuild' && env.CROSS_COMPILE }}
116+
name: Setup binfmt and qemu
117+
uses: docker/setup-qemu-action@v3
118+
with:
119+
image: tonistiigi/binfmt:qemu-v9.2.0
120+
101121
- name: Build kernel image
102122
uses: libbpf/ci/build-linux@v3
103123
with:

0 commit comments

Comments
 (0)