Skip to content

Instantly share code, notes, and snippets.

@valentinconan
Last active January 2, 2025 11:09
Show Gist options
  • Select an option

  • Save valentinconan/3b8371e17136e5ed22c4d7d31dc11e4f to your computer and use it in GitHub Desktop.

Select an option

Save valentinconan/3b8371e17136e5ed22c4d7d31dc11e4f to your computer and use it in GitHub Desktop.
Gitlab pipeline configuration

Gitlab

Runners

Install binaries

Follow instructions here [https://docs.gitlab.com/runner/install/linux-repository.html]

Install as a service

Create the service file :

sudo nano /etc/systemd/system/gitlab-runner.service

Then fill it

[Unit]
Description=GitLab Runner
After=network.target

[Service]
ExecStart=/usr/bin/gitlab-runner run
Restart=always

[Install]
WantedBy=multi-user.target

And activate it

sudo systemctl daemon-reload
sudo systemctl enable gitlab-runner
sudo systemctl start gitlab-runner

Configure runners

Create/modify this file : /etc/gitlab-runner/config.toml. Here an example :

concurrent = 5
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "build"
  url = "https://gitlab.com"
  token = "XXXXXXXX"
  executor = "shell"
  limit = 1
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

[[runners]]
  name = "test"
  url = "https://gitlab.com"
  token = "XXXXXXXX"
  executor = "docker"
  tags = ["test"]
  limit = 2
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "node:16-alpine"
    privileged = true
    user = "node"
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache", "/builds:/builds"]
    shm_size = 0
    clone_in_docker = true

privileged = true is needed if pipeline is configured to run in dind mode

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