Skip to content

Commit

Permalink
Merge pull request #254 from inoxth/runner-docker-services
Browse files Browse the repository at this point in the history
add runner.docker.services support
  • Loading branch information
riemers authored Feb 22, 2023
2 parents 4a81955 + 757b5de commit 4f29720
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ gitlab_runner_runners:
# Sets the post_build_script. The default is not set.
# post_build_script:
#
# Add [[runner.docker.services]] for docker executor
# docker_services:
# - name: docker:20.10.12-dind
# command: ["--insecure-registry=10.0.0.0/24"]

# Runner SSH user
# ssh_user: ''
#
Expand Down
13 changes: 13 additions & 0 deletions tasks/update-config-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,19 @@
- restart_gitlab_runner
- restart_gitlab_runner_macos

#### [[runners.docker.services]] section ####
- name: "{{ runn_name_prefix }} Set additional services"
blockinfile:
dest: "{{ temp_runner_config.path }}"
content: "{{ lookup('template', 'config.runners.docker.services.j2') if gitlab_runner.docker_services is defined }}"
state: "{{ 'present' if gitlab_runner.docker_services is defined else 'absent' }}"
marker: "# {mark} runners.docker.services"
insertafter: EOF
check_mode: no
notify:
- restart_gitlab_runner
- restart_gitlab_runner_macos

#### [runners.custom_build_dir] section #####
- name: "{{ runn_name_prefix }} Set custom_build_dir section"
lineinfile:
Expand Down
6 changes: 6 additions & 0 deletions templates/config.runners.docker.services.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% for service in gitlab_runner.docker_services %}
[[runners.docker.services]]
{% for attr in service %}
{{ attr }} = {{ service[attr] | to_json }}
{% endfor %}
{% endfor %}

0 comments on commit 4f29720

Please sign in to comment.