|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | | -set -euo pipefail |
| 3 | +set -xeuo pipefail |
| 4 | + |
| 5 | +export DEPS=${1:-"all"} # "build", "run" or "all" |
4 | 6 |
|
5 | 7 | # Most of the BPF CI dependencies are set up by libbpf/ci/setup-build-env action |
6 | 8 | # This script runs a subset of that, in order to cache the packages at image build time |
7 | | -export LIBBPF_CI_TAG=v3 |
| 9 | +export LIBBPF_CI_TAG=${LIBBPF_CI_TAG:-"v3"} |
| 10 | +export RUNNER_VERSION=${RUNNER_VERSION:-2.331.0} |
8 | 11 |
|
9 | 12 | # These should correspond to https://github.com/kernel-patches/vmtest/blob/master/.github/scripts/matrix.py#L20-L21 |
10 | | -# Otherwise there is no point in caching dependencies in the image |
11 | | -export GCC_VERSION=15 |
12 | | -export LLVM_VERSION=21 |
13 | | - |
14 | | -# do not install pahole and cross-compilation toolchain in the docker image |
15 | | -export TARGET_ARCH=$(uname -m) |
16 | | -export PAHOLE_BRANCH=none |
| 13 | +# Otherwise there is no point in caching the dependencies in the image |
| 14 | +export GCC_VERSION=${GCC_VERSION:-14} |
| 15 | +export LLVM_VERSION=${LLVM_VERSION:-21} |
17 | 16 |
|
18 | 17 | scratch=$(mktemp -d) |
19 | 18 | cd $scratch |
| 19 | + |
| 20 | +# Install pre-requisites for GitHub Actions Runner client app |
| 21 | +# https://github.com/actions/runner/blob/main/docs/start/envlinux.md |
| 22 | +curl -Lf https://raw.githubusercontent.com/actions/runner/v${RUNNER_VERSION}/src/Misc/layoutbin/installdependencies.sh \ |
| 23 | + -o install-gha-runner-deps.sh |
| 24 | +bash install-gha-runner-deps.sh |
| 25 | + |
| 26 | +# Use libbpf/ci/setup-build-env scripts |
20 | 27 | git clone --depth 1 --branch $LIBBPF_CI_TAG https://github.com/libbpf/ci.git actions |
21 | 28 |
|
22 | | -# Install build dependencies only on x86_64, we cross-compile everything else |
23 | | -if [ "$(uname -m)" == "x86_64" ]; then |
| 29 | +if [ "$DEPS" = "all" ] || [ "$DEPS" = "build" ]; then |
| 30 | + # do not install cross-compilation toolchain by default |
| 31 | + export TARGET_ARCH=$(uname -m) |
24 | 32 | cd "${scratch}/actions/setup-build-env" && ./action.sh |
25 | 33 | fi |
26 | 34 |
|
27 | | -cd "${scratch}/actions/run-vmtest" && ./install-dependencies.sh |
| 35 | +if [ "$DEPS" = "all" ] || [ "$DEPS" = "run" ]; then |
| 36 | + cd "${scratch}/actions/run-vmtest" && ./install-dependencies.sh |
| 37 | +fi |
| 38 | + |
| 39 | +cd / && rm -rf $scratch |
| 40 | +sudo apt-get clean |
0 commit comments