BuildKite pre-command: Install kernel headers if available, install kmod.

PiperOrigin-RevId: 452188918
This commit is contained in:
Etienne Perot
2022-05-31 18:48:20 -07:00
committed by gVisor bot
parent d9cb55b00c
commit b43a19fad0
+10 -4
View File
@@ -1,21 +1,26 @@
# Download any build-specific configuration that has been uploaded.
# This allows top-level steps to override all subsequent steps.
buildkite-agent artifact download 'tools/bazeldefs/*' . || true
# Install packages we need. Docker must be installed and configured,
# as should Go itself. We just install some extra bits and pieces.
function install_pkgs() {
export DEBIAN_FRONTEND=noninteractive
while true; do
if sudo -E apt-get update && \
sudo -E apt-get install -y "$@"; then
if sudo -E apt-get update && sudo -E apt-get install -y "$@"; then
break
fi
done
}
install_pkgs make linux-libc-dev graphviz jq curl binutils gnupg gnupg-agent \
gcc pkg-config apt-transport-https ca-certificates software-properties-common \
rsync
rsync kmod
# Install headers, only if available.
if test -n "$(apt-cache search --names-only "^linux-headers-$(uname -r)$")"; then
install_pkgs "linux-headers-$(uname -r)"
elif test -n "$(apt-cache search --names-only "^linux-gcp-headers-$(uname -r | cut -d- -f1-2)$")"; then
install_pkgs "linux-gcp-headers-$(uname -r | cut -d- -f1-2)"
fi
# Setup for parallelization with PARTITION and TOTAL_PARTITIONS.
@@ -26,7 +31,8 @@ export TOTAL_PARTITIONS=${BUILDKITE_PARALLEL_JOB_COUNT:-1}
# Ensure Docker has experimental enabled.
EXPERIMENTAL=$(sudo docker version --format='{{.Server.Experimental}}')
if test "${EXPERIMENTAL}" != "true"; then
make sudo TARGETS=//runsc:runsc ARGS="install --experimental=true"
make sudo TARGETS=//runsc:runsc \
ARGS="install --experimental=true -- ${RUNTIME_ARGS:-}"
sudo systemctl restart docker
fi