Skip to content

Instantly share code, notes, and snippets.

@lukaszlach
Last active October 4, 2024 14:06
Show Gist options
  • Save lukaszlach/7ad6e10ae363b12303e0be36c0f2955d to your computer and use it in GitHub Desktop.
Save lukaszlach/7ad6e10ae363b12303e0be36c0f2955d to your computer and use it in GitHub Desktop.
version: '3.5'
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://${GITLAB_HOST}'
registry_external_url 'http://${GITLAB_REGISTRY_HOST}'
gitlab_rails['initial_root_password'] = 'passw0rd'
gitlab_rails['initial_shared_runners_registration_token'] = 't0ken'
ports:
- 80:80
volumes:
- ./gitlab/config:/etc/gitlab
- ./gitlab/logs:/var/log/gitlab
- ./gitlab/data:/var/opt
networks:
default:
aliases:
- "${GITLAB_HOST}"
- "${GITLAB_REGISTRY_HOST}"
- "${GITLAB_PAGES_HOST}"
gitlab-runner:
image: gitlab/gitlab-runner:alpine
container_name: gitlab-runner
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./gitlab-runner/config:/etc/gitlab-runner
depends_on:
- gitlab
register-gitlab-runner:
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab-runner/config:/etc/gitlab-runner
command:
- register
- --non-interactive
- --locked=false
- --run-untagged
- --name=GitLab Runner
- --tag-list=docker,dind
- --executor=docker
- --docker-image=docker:stable
- --docker-volumes=/var/run/docker.sock:/var/run/docker.sock
- --docker-network-mode=gitlab-default
environment:
- "CI_SERVER_URL=http://${GITLAB_HOST}"
- "REGISTRATION_TOKEN=t0ken"
depends_on:
- gitlab
networks:
default:
name: gitlab-default
@BuildWithLal
Copy link

BuildWithLal commented Sep 12, 2024

This no longer works in latest GitLab. From GitLab docs

The ability to pass a runner registration token, and support for certain configuration arguments was deprecated in GitLab 15.6 and will be removed in GitLab 18.0. Runner authentication tokens should be used instead. For more information, see Migrating to the new runner registration workflow.

And i am not seeing a way to feed a predefined shared authentication token in GitLab config/env-vars unless you create it in GitLab administration/runner creation.

Also the flag --tag-list is not supported as well when using newly introduced authentication token

gitlab-runner  | FATAL: Runner configuration other than name and executor configuration is reserved
(specifically --locked, --access-level, --run-untagged, --maximum-timeout, --paused, --tag-list, and --maintenance-note)
and cannot be specified when registering with a runner authentication token.
This configuration is specified on the GitLab server. Please try again without specifying any of those arguments.
For more information, 
see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow.html#changes-to-the-gitlab-runner-register-command-syntax 

@avoidik
Copy link

avoidik commented Oct 4, 2024

@BuildWithLal your should change a feature flag to be able to revert back to previous behavior, ref. link https://docs.gitlab.com/ee/administration/settings/continuous_integration.html#enable-runner-registrations-tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment