Skip to content
Snippets Groups Projects

Provision gitlab runner

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    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.

    Edited
    provision-gitlab-runner.sh 795 B
    #!/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
    • The spaces before EOF needs to be replaced with a tab.

    • Thanks, happened when copying to this snippet

    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment