Commit 9ee3fdcd authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Añade nuevas variables de configuración

See merge request redmic-project/gitlab-runner!7
parents 58b0a843 44b1603f
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -4,13 +4,15 @@ Deployment of a service to run GitLab CI/CD workloads

## Deployment

At first time, you must deploy `gitlab-runner-registrar` to configure and register a new runner instance. Then, deploy `gitlab-runner` (launching default deployment jobs) to receive jobs to run.
First time, you must deploy `gitlab-runner-registrar` service to configure and register a new runner instance. This action creates a configuration file into a shared volume, ready for `gitlab-runner` to use.

Then, deploy `gitlab-runner` (launching default-named deployment jobs) to start receiving jobs to run.

## Delete old runners

Service will try to unregister old version of same runner being registered, before creating the new one.

When runners name change, you must delete old registrations manually. Go to a running gitlab-runner container shell and execute one of the following commands:
When runners name change, you must delete old registrations manually. Go to a running `gitlab-runner` container shell and execute one of the following commands:

```sh
# Remove one runner, by GitLab instance URL and runner token
@@ -25,3 +27,11 @@ gitlab-runner verify --delete
# Remove all runners
gitlab-runner unregister --all-runners
```

## Environment isolation

This service is configured to work with `docker` executor. By default, your CI jobs will run in a Docker container launched at the host system of `gitlab-runner` service, sharing the same Docker daemon and resources (networks, volumes...) with host and other CI jobs running concurrently.

In some use cases this is a desired behaviour, because you need local resources from host or it's local network.

To achieve isolation from host's Docker environment (and other CI jobs running concurrently), you should use `dind` (docker-in-docker) as a service, applied to your CI job at `.gitlab-ci.yml`. This way, launched container cannot see any external resources.
+6 −0
Original line number Diff line number Diff line
@@ -2,11 +2,16 @@ IMAGE_NAME=gitlab/gitlab-runner
IMAGE_TAG=alpine

CONFIG_FILE=/etc/gitlab-runner/config.toml
LISTEN_ADDRESS=:9252
CONCURRENT=3
REGISTRAR_LOG_LEVEL=info
LOG_LEVEL=warn
CI_SERVER_URL=https://gitlab.com/
REGISTRATION_TOKEN=changeme
REGISTER_NON_INTERACTIVE=true
REGISTER_LOCKED=false
REGISTER_RUN_UNTAGGED=true
REGISTER_MAXIMUM_TIMEOUT=7200
RUNNER_NAME=redmic-gitlab-runner
RUNNER_TAG_LIST=custom-runner
RUNNER_LIMIT=0
@@ -17,6 +22,7 @@ RUNNER_ENV=DOCKER_TLS_CERTDIR=

DOCKER_IMAGE=alpine:latest
DOCKER_PRIVILEGED=true
DOCKER_OOM_KILL_DISABLE=false
DOCKER_DISABLE_CACHE=false
DOCKER_NETWORK_MODE=gitlab-net
DOCKER_SHM_SIZE=1000000000
+10 −4
Original line number Diff line number Diff line
@@ -4,17 +4,22 @@ services:
  gitlab-runner-registrar:
    image: ${IMAGE_NAME}:${IMAGE_TAG}
    entrypoint: /bin/sh
    command: >
      -c "
        gitlab-runner unregister --name \"${RUNNER_NAME}\";
        gitlab-runner register"
    command:
      - -c
      - |
        gitlab-runner unregister --name $$(echo "$${RUNNER_NAME}");
        gitlab-runner register;
        sed -i "$$(echo s/concurrent.*/concurrent = $${CONCURRENT}/)" $$(echo "$${CONFIG_FILE}")
    environment:
      CONFIG_FILE:
      CONCURRENT:
      LOG_LEVEL: ${REGISTRAR_LOG_LEVEL}
      CI_SERVER_URL:
      REGISTRATION_TOKEN:
      REGISTER_NON_INTERACTIVE:
      REGISTER_LOCKED:
      REGISTER_RUN_UNTAGGED:
      REGISTER_MAXIMUM_TIMEOUT:
      RUNNER_NAME:
      RUNNER_TAG_LIST:
      RUNNER_LIMIT:
@@ -24,6 +29,7 @@ services:
      RUNNER_ENV:
      DOCKER_IMAGE:
      DOCKER_PRIVILEGED:
      DOCKER_OOM_KILL_DISABLE:
      DOCKER_DISABLE_CACHE:
      DOCKER_VOLUMES:
      DOCKER_NETWORK_MODE:
+8 −0
Original line number Diff line number Diff line
@@ -5,8 +5,11 @@ services:
    image: ${IMAGE_NAME}:${IMAGE_TAG}
    environment:
      CONFIG_FILE:
      LISTEN_ADDRESS:
      LOG_LEVEL:
    networks:
      gitlab-net:
      metric-net:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - config-vol:/etc/gitlab-runner
@@ -35,3 +38,8 @@ networks:
    name: ${GITLAB_NET_NAME}
    driver: ${GITLAB_NET_DRIVER}
    external: true

  metric-net:
    name: ${METRIC_NET_NAME:-metric-net}
    driver: ${METRIC_NET_DRIVER:-overlay}
    external: true