#!/usr/bin/env bash # Install or update the gitlab-runner binary on a base VM that jobs' VMs are # copied from. From https://exe.dev/deploy/gitlab-runner. Jobs need it on # their PATH for caches and artifacts; nothing here registers or starts a # runner, so copies of this VM never ask GitLab for jobs themselves. set -euo pipefail dl=https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest cd "$(mktemp -d)" curl -fsSL -o gitlab-runner-linux-amd64 "$dl/binaries/gitlab-runner-linux-amd64" curl -fsSL "$dl/release.sha256" \ | awk '$2 == "binaries/gitlab-runner-linux-amd64" {print $1 " gitlab-runner-linux-amd64"}' \ | sha256sum -c - sudo install -m 755 gitlab-runner-linux-amd64 /usr/local/bin/gitlab-runner # Git LFS, which GitLab Runner expects next to git. command -v git-lfs >/dev/null || sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git-lfs >/dev/null 2>&1 # Containers in jobs: start Docker with the VM rather than on first use. sudo systemctl enable --now docker.service >/dev/null 2>&1 mkdir -p ~/builds ~/cache sync gitlab-runner --version | head -1