From b43a19fad0e480081cbc09b618c5150ef4dcc2c1 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Tue, 31 May 2022 18:45:22 -0700 Subject: [PATCH] BuildKite pre-command: Install kernel headers if available, install `kmod`. PiperOrigin-RevId: 452188918 --- .buildkite/hooks/pre-command | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 3b9906b85..96011f292 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -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