Skip to content

Commit

Permalink
Merge pull request #116 from xabim/add-clone_url
Browse files Browse the repository at this point in the history
Add clone_url option
  • Loading branch information
riemers authored Apr 23, 2020
2 parents 5803038 + e083dbf commit e7baa12
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ gitlab_runner_runners:
locked: 'false'
# Custom environment variables injected to registration command
env_vars: []
# Sets the clone_url. The default is not set.
# clone_url:
#
# Sets the pre_clone_script. The default is not set.
# pre_clone_script:
#
Expand Down
3 changes: 3 additions & 0 deletions tasks/register-runner-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
--registration-token '{{ gitlab_runner.token|default(gitlab_runner_registration_token) }}'
--description '{{ gitlab_runner.name|default(ansible_hostname+"-"+gitlab_runner_index|string) }}'
--tag-list '{{ gitlab_runner.tags|default([]) | join(",") }}'
{% if gitlab_runner.clone_url|default(false) %}
--clone-url "{{ gitlab_runner.clone_url }}"
{% endif %}
{% if gitlab_runner.run_untagged|default(true) %}
--run-untagged
{% endif %}
Expand Down
3 changes: 3 additions & 0 deletions tasks/register-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
--registration-token '{{ gitlab_runner.token|default(gitlab_runner_registration_token) }}'
--description '{{ gitlab_runner.name|default(ansible_hostname+"-"+gitlab_runner_index|string) }}'
--tag-list '{{ gitlab_runner.tags|default([]) | join(",") }}'
{% if gitlab_runner.clone_url|default(false) %}
--clone-url "{{ gitlab_runner.clone_url }}"
{% endif %}
{% if gitlab_runner.run_untagged|default(true) %}
--run-untagged
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions tasks/update-config-runner-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
check_mode: no
notify: restart_gitlab_runner_windows

- name: (Windows) Set clone URL
win_lineinfile:
dest: "{{ temp_runner_config.path }}"
regexp: '^\s*clone_url ='
line: ' clone_url = {{ gitlab_runner.clone_url | to_json }}'
state: present
insertafter: '^\s*url ='
backrefs: no
check_mode: no
notify: restart_gitlab_runner
when: gitlab_runner.clone_url is defined

- name: (Windows) Set environment option
win_lineinfile:
dest: "{{ temp_runner_config.path }}"
Expand Down
14 changes: 14 additions & 0 deletions tasks/update-config-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
- restart_gitlab_runner
- restart_gitlab_runner_macos

- name: Set clone URL
win_lineinfile:
dest: "{{ temp_runner_config.path }}"
regexp: '^\s*clone_url ='
line: ' clone_url = {{ gitlab_runner.clone_url | to_json }}'
state: present
insertafter: '^\s*url ='
backrefs: no
check_mode: no
notify:
- restart_gitlab_runner
- restart_gitlab_runner_macos
when: gitlab_runner.clone_url is defined

- name: Set environment option
lineinfile:
dest: "{{ temp_runner_config.path }}"
Expand Down

0 comments on commit e7baa12

Please sign in to comment.