Skip to content

Commit 70705ca

Browse files
committed
Support docker host parameter to allow Podman support
1 parent b572744 commit 70705ca

File tree

2 files changed

+41
-37
lines changed

2 files changed

+41
-37
lines changed

roles/gitlab_runner/README.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -200,43 +200,44 @@ Each list entry corresponds to one registered GitLab-Runner.
200200
Below table lists and describes all available configuration options you can
201201
specify for registering your GitLab-Runner with this Ansible role.
202202

203-
| Key | Example | Description |
204-
|-----------------------------|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
205-
| `name` | `"my-docker-runner"` | The name of the registered runner. |
206-
| `url` | `"https://gitlab.com"` | The URL of the GitLab instance you want to register the runner with. |
207-
| `description` | `"My first Docker runner"` | Description of the runner. |
208-
| `authentication_token` | `"MY_SECURE_TOKEN"` | The runner authentication token required to register the runner. |
209-
| `executor` | `docker` | Specify, the runner [executor](https://docs.gitlab.com/runner/executors/#selecting-the-executor). |
210-
| `limit` | `0` | Limit how many jobs can be handled concurrently by this token. Default is `0` (no limit). |
211-
| `environment` | `["DOCKER_TLS_CERTDIR=/certs"]` | Append or overwrite environment variables. |
212-
| `docker_image` | `"python:3.8"` | Specify the default docker image to be used. Required for `docker` and `docker+machine` executor. |
213-
| `docker_security_opts` | `["seccomp=unconfined"]` | Configure Docker security options. |
214-
| `docker_devices` | `["/dev/kfd", "/dev/dri"]` | Add a host device to the container. Same syntax as the Docker `--device` flag. |
215-
| `docker_volumes` | `["/cache", "/certs/client"]` | Additional volumes that should be mounted. Same syntax as the Docker -v flag. |
216-
| `docker_shm_size` | `2147483648` | Shared memory size for images (in bytes). Default is 0 resulting in a fallback to the Docker default. |
217-
| `docker_cpus` | `2` | Number of CPUs. Unset by default. |
218-
| `docker_memory` | `2g` | Docker container memory limit. Unset by default. |
219-
| `docker_gpus` | `all` | Specify GPUs to make available in Docker containers. Unset by default. |
220-
| `docker_network_mtu` | `1442` | A custom MTU is necessary in some environments like VMs in Openstack. Requires Gitlab-Runner >= `16.5` |
221-
| `docker_privileged` | `False` | Specify, if the container runs in privileged mode (insecure). Default is `False`. |
222-
| `docker_tls_verify` | `True` | Specify, if TLS connections to the Docker daemon should be verified. Default is `False`. |
223-
| `docker_disable_cache` | `False` | Specify, to disable the use of automatically created docker volumes for caching. |
224-
| `machine_driver` | `"openstack"` | The driver to use when creating the machine via `docker-machine`. |
225-
| `machine_name` | `"auto-scale-%s"` | The machine name template. (You need to include `%s`). |
226-
| `machine_options` | See the machine example. | Additional machine creation options. |
227-
| `machine_idle_count` | `2` | Number of machines that need to be created and waiting in Idle state. Default is `0`. |
228-
| `machine_idle_scale_factor` | `0.0` | *(Experimental)* Number of Idle machines as a factor of the number of machines currently in use. Default is `0.0`. |
229-
| `machine_idle_count_min` | `1` | Minimal number of machines that need to be created and waiting in Idle state when the IdleScaleFactor is in use. Default is 1. |
230-
| `machine_idle_time` | `1800` | Time (in seconds) for machine to be in Idle state before it is removed. Default is `0`. |
231-
| `machine_max_growth_rate` | `1` | The maximum number of machines that can be added to the runner in parallel. Default is `0` (no limit). |
232-
| `machine_max_builds` | `1` | Maximum job (build) count before machine is removed. Default is `0`. |
233-
| `cache_type` | `"s3"` | Type of caching to use. Currently only `s3` is supported by this role. |
234-
| `cache_server_address` | `"https://s3.hifis.net"` | A `host:port` for the S3-compatible server. |
235-
| `cache_access_key` | `"key"` | The access key specified for your S3 instance.. |
236-
| `cache_secret_key` | `"secret"` | The secret key specified for your S3 instance. |
237-
| `cache_bucket_name` | `"bucket-name"` | Name of the storage bucket where cache is stored. |
238-
| `cache_bucket_location` | `"eu-west-1"` | Name of S3 region. (optional) |
239-
| `cache_insecure` | `"false"` | Set to `"true"` if the S3 service is available by HTTP. Default is `"false"`. |
203+
| Key | Example | Description |
204+
| --------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
205+
| `name` | `"my-docker-runner"` | The name of the registered runner. |
206+
| `url` | `"https://gitlab.com"` | The URL of the GitLab instance you want to register the runner with. |
207+
| `description` | `"My first Docker runner"` | Description of the runner. |
208+
| `authentication_token` | `"MY_SECURE_TOKEN"` | The runner authentication token required to register the runner. |
209+
| `executor` | `docker` | Specify, the runner [executor](https://docs.gitlab.com/runner/executors/#selecting-the-executor). |
210+
| `limit` | `0` | Limit how many jobs can be handled concurrently by this token. Default is `0` (no limit). |
211+
| `environment` | `["DOCKER_TLS_CERTDIR=/certs"]` | Append or overwrite environment variables. |
212+
| `docker_image` | `"python:3.8"` | Specify the default docker image to be used. Required for `docker` and `docker+machine` executor. |
213+
| `docker_security_opts` | `["seccomp=unconfined"]` | Configure Docker security options. |
214+
| `docker_devices` | `["/dev/kfd", "/dev/dri"]` | Add a host device to the container. Same syntax as the Docker `--device` flag. |
215+
| `docker_volumes` | `["/cache", "/certs/client"]` | Additional volumes that should be mounted. Same syntax as the Docker -v flag. |
216+
| `docker_shm_size` | `2147483648` | Shared memory size for images (in bytes). Default is 0 resulting in a fallback to the Docker default. |
217+
| `docker_cpus` | `2` | Number of CPUs. Unset by default. |
218+
| `docker_memory` | `2g` | Docker container memory limit. Unset by default. |
219+
| `docker_gpus` | `all` | Specify GPUs to make available in Docker containers. Unset by default. |
220+
| `docker_network_mtu` | `1442` | A custom MTU is necessary in some environments like VMs in Openstack. Requires Gitlab-Runner >= `16.5` |
221+
| `docker_privileged` | `False` | Specify, if the container runs in privileged mode (insecure). Default is `False`. |
222+
| `docker_tls_verify` | `True` | Specify, if TLS connections to the Docker daemon should be verified. Default is `False`. |
223+
| `docker_disable_cache` | `False` | Specify, to disable the use of automatically created docker volumes for caching. |
224+
| `docker_host` | `unix:///run/user/1000/podman/podman.sock` | Custom Docker endpoint. Not configured by default by the role. |
225+
| `machine_driver` | `"openstack"` | The driver to use when creating the machine via `docker-machine`. |
226+
| `machine_name` | `"auto-scale-%s"` | The machine name template. (You need to include `%s`). |
227+
| `machine_options` | See the machine example. | Additional machine creation options. |
228+
| `machine_idle_count` | `2` | Number of machines that need to be created and waiting in Idle state. Default is `0`. |
229+
| `machine_idle_scale_factor` | `0.0` | *(Experimental)* Number of Idle machines as a factor of the number of machines currently in use. Default is `0.0`. |
230+
| `machine_idle_count_min` | `1` | Minimal number of machines that need to be created and waiting in Idle state when the IdleScaleFactor is in use. Default is 1. |
231+
| `machine_idle_time` | `1800` | Time (in seconds) for machine to be in Idle state before it is removed. Default is `0`. |
232+
| `machine_max_growth_rate` | `1` | The maximum number of machines that can be added to the runner in parallel. Default is `0` (no limit). |
233+
| `machine_max_builds` | `1` | Maximum job (build) count before machine is removed. Default is `0`. |
234+
| `cache_type` | `"s3"` | Type of caching to use. Currently only `s3` is supported by this role. |
235+
| `cache_server_address` | `"https://s3.hifis.net"` | A `host:port` for the S3-compatible server. |
236+
| `cache_access_key` | `"key"` | The access key specified for your S3 instance.. |
237+
| `cache_secret_key` | `"secret"` | The secret key specified for your S3 instance. |
238+
| `cache_bucket_name` | `"bucket-name"` | Name of the storage bucket where cache is stored. |
239+
| `cache_bucket_location` | `"eu-west-1"` | Name of S3 region. (optional) |
240+
| `cache_insecure` | `"false"` | Set to `"true"` if the S3 service is available by HTTP. Default is `"false"`. |
240241

241242
#### Docker Example
242243

roles/gitlab_runner/templates/config.toml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ sentry_dsn = "{{ gitlab_runner_sentry_dsn }}"
4848
{% endif %}
4949
{% if "docker" in runner.executor %}
5050
[runners.docker]
51+
{% if runner.docker_host | default('') | length > 0 %}
52+
host = "{{ runner.docker_host }}"
53+
{% endif %}
5154
tls_verify = {{ runner.docker_tls_verify | default(false) | bool | to_json }}
5255
image = "{{ runner.docker_image }}"
5356
{% if runner.docker_memory | default('') | length > 0 %}

0 commit comments

Comments
 (0)