Sign inSign up

flakm/gitlab-runner-auto-register

By flakm

Updated over 7 years ago

Dockered *gitlab-runner* with auto registering capabilities (fork pcodk/gitlab-runner-auto-register)

Image
2

100K+

flakm/gitlab-runner-auto-register repository overview

Gitlab Runner Auto Register

Created according to official doc with additional flags to enable auto registry with given url and token.

The default image needs additional step of executing script from outside of container which makes it hard to automate deployment.

Gitlab runner version

tagversion
0.0.310.2.0
0.0.4-0.0.910.4.0
11.7.011.7.0

Running instructions

To run simply execute

REGISTRATION_TOKEN=""
docker run -d -e CI_SERVER_URL="https://gitlab.com/" \
   -e REGISTRATION_TOKEN="$REGISTRATION_TOKEN" \
   --name gitlab-runner \
   -v /var/run/docker.sock:/var/run/docker.sock \
   flakm/gitlab-runner-auto-register:latest 

To create runner that registres itself in more then one project set LOCKED_MODE to false and provide both ADMIN_TOKEN and PROJECTS_TO_REGISTER variables.

REGISTRATION_TOKEN=""
ADMIN_TOKEN=""
PROJECTS_TO_REGISTER="5309683;4904307" 

docker run -d -e "CI_SERVER_URL=https://gitlab.com/" \
   -e REGISTRATION_TOKEN="$REGISTRATION_TOKEN" \
   -e ADMIN_TOKEN="$ADMIN_TOKEN" \
   -e PROJECTS_TO_REGISTER="$PROJECTS_TO_REGISTER" \
   -e REGISTER_LOCKED="false" \
   --name gitlab-runner-testing \
   -v /var/run/docker.sock:/var/run/docker.sock \
   flakm/gitlab-runner-auto-register:latest

To check logs and registration status use

docker logs gitlab-runner

To check registration details

docker exec -i gitlab-runner cat /etc/gitlab-runner/config.toml

Or register new runner

docker exec -i gitlab-runner gitlab-runner register

Environment Variables

PropertyDescriptionDefault valueRequired
CI_SERVER_URLurl of gitlab instancetrue
REGISTRATION_TOKEN/settings/ci_cd tab of your projecttrue
DOCKER_PRIVILEGEDshould you need to run in priviliged mode set to true (otherwise defaults to false)falsefalse
REGISTER_LOCKEDshould this runner be locked to this project or nottruefalse
ADMIN_TOKENaccess token with admin privilages (if specified runner will be registered for projectsPROJECTS_TO_REGISTER)false
PROJECTS_TO_REGISTERproject ids seperated by , or ;false
CUSTOM_RUNNER_NAMErunner's description$HOSTNAMEfalse
DOCKER_VOLUMESvolume mounted by this runnerfalse
DOCKER_IMAGEdocker image to usedocker:18.01.0-cetrue
REGISTER_EXTRA_ARGScan contain extra arguments for running gitlab-runner register.
Can be used for example to specify multiple --docker-volumes args
false
RUNNER_TAG_LISTtags for given runnerfalse

For more information about the the environment variables execute:

docker run --rm --entrypoint "/usr/bin/gitlab-runner" flakm/gitlab-runner-auto-register:latest register --help

Inspiration

Forked form https://github.com/pcodk/gitlab-runner-auto-register https://github.com/ayufan/gitlab-ci-multi-runner

Tag summary

Content type

Image

Digest

Size

138.6 MB

Last updated

over 7 years ago

docker pull flakm/gitlab-runner-auto-register