Provision gitlab runner
The snippet can be accessed without any authentication.
Authored by
Kevin Daudt
A personal access token is required that has at least the create_runner
scope. For instance_type runners, the token needs to belong to an administrator.
#!/bin/sh
set -eu -o pipefail
apk upgrade --update --available
apk add htop vim curl tpaste git docker docker-cli-compose
if ! [ -f /etc/docker/daemon.json ]; then
mkdir -p /etc/docker
cat <<-EOF >/etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "fd80::/64"
}
EOF
fi
rc-update add docker default
rc-service docker start
mkdir -p /root/compose
cd /root/compose
if ! [ -f gitlab-runner-alpine-ci ]; then
git clone https://gitlab.alpinelinux.org/alpine/infra/compose/gitlab-runner-alpine-ci.git
cd gitlab-runner-alpine-ci
for profile_path in profiles-available/*; do
profile=$(basename "$profile_path")
ln -s ../profiles-available/"$profile" profiles-enabled/"$profile"
done
fi
cd /root/compose/gitlab-runner-alpine-ci
./setup-runners.sh
docker compose up -d