github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/.buildkite/hooks/pre-command (about)

     1  # Install packages we need. Docker must be installed and configured,
     2  # as should Go itself. We just install some extra bits and pieces.
     3  function install_pkgs() {
     4    while true; do
     5      if sudo apt-get update && sudo apt-get install -y "$@"; then
     6        break
     7      fi
     8    done
     9  }
    10  install_pkgs make "linux-headers-$(uname -r)" linux-libc-dev \
    11    graphviz jq curl binutils gnupg gnupg-agent golang-go \
    12    apt-transport-https ca-certificates software-properties-common
    13  
    14  # Setup for parallelization with PARTITION and TOTAL_PARTITIONS.
    15  export PARTITION=${BUILDKITE_PARALLEL_JOB:-0}
    16  PARTITION=$((${PARTITION}+1)) # 1-indexed, but PARALLEL_JOB is 0-indexed.
    17  export TOTAL_PARTITIONS=${BUILDKITE_PARALLEL_JOB_COUNT:-1}
    18  
    19  # Ensure Docker has experimental enabled.
    20  EXPERIMENTAL=$(sudo docker version --format='{{.Server.Experimental}}')
    21  if test "${EXPERIMENTAL}" != "true"; then
    22    make sudo TARGETS=//runsc:runsc ARGS="install --experimental=true"
    23    sudo systemctl restart docker
    24  fi
    25  
    26  # Helper for benchmarks, based on the branch.
    27  if test "${BUILDKITE_BRANCH}" = "master"; then
    28    export BENCHMARKS_OFFICIAL=true
    29  else
    30    export BENCHMARKS_OFFICIAL=false
    31  fi
    32  
    33  # Clear existing profiles.
    34  sudo rm -rf /tmp/profile