4646jobs :
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+ # AWS docs about image override: https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-action-runners-update-labels.html
50+ runs-on :
51+ - ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
52+ - image:${{ inputs.arch == 'aarch64' && 'custom-arm-ghcr.io/kernel-patches/runner:kbuilder-debian-arm64'
53+ || 'custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64' }} # default
54+ # - image:linux-5.0
55+ # container: ghcr.io/kernel-patches/runner:debian-x86_64
5856 env :
5957 ARTIFACTS_ARCHIVE : " vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"
60- BPF_NEXT_BASE_BRANCH : ' master'
6158 BPF_NEXT_FETCH_DEPTH : 64 # A bit of history is needed to facilitate incremental builds
62- CROSS_COMPILE : ${{ inputs.arch != 'x86_64 ' && 'true' || '' }}
59+ CROSS_COMPILE : ${{ inputs.arch == 's390x ' && 'true' || '' }}
6360 BUILD_SCHED_EXT_SELFTESTS : ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
6461 KBUILD_OUTPUT : ${{ github.workspace }}/kbuild-output
6562 KERNEL : ${{ inputs.kernel }}
6663 KERNEL_ROOT : ${{ github.workspace }}
64+ KERNEL_ORIGIN : ${{ github.repository == 'kernel-patches/bpf-rc' && 'https://github.com/kernel-patches/bpf-rc.git'
65+ || 'https://github.com/kernel-patches/bpf.git'
66+ }}
67+ KERNEL_REVISION : ${{ inputs.download_sources && 'bpf-next' || github.sha }}
6768 REFERENCE_REPO_PATH : /libbpfci/mirrors/linux
6869 REPO_PATH : " "
6970 REPO_ROOT : ${{ github.workspace }}
70- RUNNER_TYPE : ${{ contains(fromJSON(inputs.runs_on), ' codebuild') && 'codebuild' || 'default' }}
71+ RUNNER_TYPE : codebuild
7172 steps :
7273
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-
8674 - uses : actions/checkout@v4
8775 with :
8876 sparse-checkout : |
@@ -93,42 +81,14 @@ jobs:
9381 shell : bash
9482 run : .github/scripts/tmpfsify-workspace.sh
9583
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
84+ - name : Download bpf-next tree @ ${{ env.KERNEL_REVISION }}
85+ uses : libbpf/ci/get-linux-source@v3
11486 env :
11587 FETCH_DEPTH : ${{ env.BPF_NEXT_FETCH_DEPTH }}
116- uses : libbpf/ci/get-linux-source@v3
11788 with :
11889 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 }}
90+ repo : ${{ env.KERNEL_ORIGIN }}
91+ rev : ${{ env.KERNEL_REVISION }}
13292
13393 - name : Move linux source in place
13494 shell : bash
@@ -145,25 +105,13 @@ jobs:
145105 repo-root : ${{ env.REPO_ROOT }}
146106
147107 - name : Setup build environment
148- uses : libbpf/ci/setup-build-env@v3
108+ uses : libbpf/ci/setup-build-env@debian-build-env
149109 with :
150110 arch : ${{ inputs.arch }}
151111 gcc-version : ${{ inputs.gcc_version }}
152112 llvm-version : ${{ inputs.llvm_version }}
153113 pahole : master
154114
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-
167115 - name : Build kernel image
168116 uses : libbpf/ci/build-linux@v3
169117 with :
@@ -174,7 +122,7 @@ jobs:
174122 llvm-version : ${{ inputs.llvm_version }}
175123
176124 - name : Build selftests/bpf
177- uses : libbpf/ci/build-selftests@v3
125+ uses : libbpf/ci/build-selftests@debian-build-env
178126 env :
179127 MAX_MAKE_JOBS : 32
180128 RELEASE : ${{ inputs.release && '1' || '' }}
0 commit comments