Commit 149fbccf authored by Kevin Daudt's avatar Kevin Daudt

merge: register-runner: split the runner into two runners

See merge request !5
parents aa9ee7fe 3f4051a2
Pipeline #3608 passed with stages
in 4 minutes and 42 seconds
...@@ -11,8 +11,10 @@ There is a `docker-compose.yml` file included that starts up the runner. The ...@@ -11,8 +11,10 @@ There is a `docker-compose.yml` file included that starts up the runner. The
registration of the runner will be done automatically, but you need to modify registration of the runner will be done automatically, but you need to modify
the file to specify some parameters: the file to specify some parameters:
* `<token>` - The gitlab registration token (you can find it in the admin pannel * `<shared-token>` - The gitlab registration token (you can find it in the admin pannel
under runners) under runners)
* `<docker-token>` - The gitlab registration token for the dedicated docker
image runner. This token should come from a project or group.
* `<arch>` - The architecture for this runner (used as a description and tag). * `<arch>` - The architecture for this runner (used as a description and tag).
Then run `docker-compose up -d` and the runner should be running. Then run `docker-compose up -d` and the runner should be running.
...@@ -9,5 +9,6 @@ services: ...@@ -9,5 +9,6 @@ services:
- /srv/gitlab-runner/home:/home/gitlab-runner - /srv/gitlab-runner/home:/home/gitlab-runner
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
environment: environment:
GITLAB_REGISTRATION_TOKEN: <token> GITLAB_REGISTRATION_TOKEN_SHARED: <shared-token>
GITLAB_REGISTRATION_TOKEN_DOCKER: <docker-token>
ARCH: <arch> ARCH: <arch>
#!/bin/sh #!/bin/sh
if [ ! -f /etc/gitlab-runner/config.toml ]; then if [ ! -f /etc/gitlab-runner/config.toml ]; then
if [ -z "$GITLAB_REGISTRATION_TOKEN" ] || [ "$GITLAB_REGISTRATION_TOKEN" = '<token>' ]; then if [ -z "$GITLAB_REGISTRATION_TOKEN_SHARED" ] || [ "$GITLAB_REGISTRATION_TOKEN_SHARED" = '<token>' ]; then
echo "Runner is not configured. Please provide 'GITLAB_REGISTRATION_TOKEN'" echo "Runner is not configured. Please provide 'GITLAB_REGISTRATION_TOKEN'"
exit 1 exit 1
fi fi
......
...@@ -2,22 +2,39 @@ ...@@ -2,22 +2,39 @@
echo "-> Registering runner $ARCH" echo "-> Registering runner $ARCH"
success=1
gitlab-runner register \ gitlab-runner register \
--non-interactive \ --non-interactive \
--url "https://gitlab.alpinelinux.org/" \ --url "https://gitlab.alpinelinux.org/" \
--registration-token "$GITLAB_REGISTRATION_TOKEN" \ --registration-token "$GITLAB_REGISTRATION_TOKEN_SHARED" \
--executor "docker" \ --executor "docker" \
--docker-image alpine:latest \ --docker-image alpine:latest \
--description "docker-runner ($ARCH)" \ --description "docker-runner ($ARCH)" \
--tag-list "docker-alpine,$ARCH" \ --tag-list "docker-alpine,$ARCH,ci-build" \
--run-untagged="true" \ --run-untagged="false" \
--locked="false" \ --locked="false" \
--access-level="not_protected" \ --access-level="not_protected" \
--limit=2 \
--output-limit=102400 \
--docker-helper-image alpinelinux/gitlab-runner-helper:latest || success=0;
gitlab-runner register \
--non-interactive \
--url "https://gitlab.alpinelinux.org/" \
--registration-token "$GITLAB_REGISTRATION_TOKEN_DOCKER" \
--executor "docker" \
--docker-image alpine:latest \
--description "docker-runner-docker ($ARCH)" \
--tag-list "docker-alpine,$ARCH,ci-docker-image" \
--run-untagged="false" \
--locked="true" \
--access-level="not_protected" \
--limit=1 \
--docker-helper-image alpinelinux/gitlab-runner-helper:latest \ --docker-helper-image alpinelinux/gitlab-runner-helper:latest \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock --docker-volumes /var/run/docker.sock:/var/run/docker.sock || success=0;
status=$? if [ $success -eq 1 ]; then
if [ $status -eq 0 ]; then
echo "-> Registration success" echo "-> Registration success"
else else
echo "-> Something went wrong" echo "-> Something went wrong"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment