Skip to content

Commit acd922c

Browse files
falonguenhter
authored andcommitted
manage request_concurrency parameter
1 parent d41eb2c commit acd922c

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ gitlab_runner_runners:
112112
token: 'abcd'
113113
# url is an optional override to the global gitlab_runner_coordinator_url
114114
url: 'https://my-own-gitlab.mydomain.com'
115+
request_concurrency: 2
115116
executor: docker
116117
docker_image: 'alpine'
117118
tags:

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ gitlab_runner_runners:
154154
# Maximum number of jobs to run concurrently on this specific runner.
155155
# Defaults to 0, simply means don't limit.
156156
concurrent_specific: "0"
157+
# Limits concurrent HTTP requests to GitLab API per runner configuration
158+
# See at https://support.gitlab.com/hc/en-us/articles/21324350882076-GitLab-Runner-Concurrency-Tuning-Understanding-request-concurrency
159+
# request_concurrency:
157160
# The default Docker image to use. Required when executor is `docker`.
158161
docker_image: ""
159162
# Set to override the default helper image that is used.

tasks/update-config-runner-windows.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
check_mode: false
2222
notify: restart_gitlab_runner_windows
2323

24+
- name: "Set request concurrency option {{ runn_name_prefix }}"
25+
community.windows.win_lineinfile:
26+
dest: "{{ temp_runner_config.path }}"
27+
regexp: ^\s*request_concurrency =
28+
line: " request_concurrency = {{ gitlab_runner.request_concurrency }}"
29+
state: present
30+
insertafter: ^\s*limit =
31+
backrefs: false
32+
check_mode: false
33+
notify:
34+
- restart_gitlab_runner_windows
35+
when: gitlab_runner.request_concurrency is defined
36+
2437
- name: "Set coordinator URL {{ runn_name_prefix }}"
2538
community.windows.win_lineinfile:
2639
dest: "{{ temp_runner_config.path }}"

tasks/update-config-runner.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
- restart_gitlab_runner
1414
- restart_gitlab_runner_macos
1515

16+
- name: "Set request concurrency option {{ runn_name_prefix }}"
17+
ansible.builtin.lineinfile:
18+
dest: "{{ temp_runner_config.path }}"
19+
regexp: ^\s*request_concurrency =
20+
line: " request_concurrency = {{ gitlab_runner.request_concurrency }}"
21+
state: present
22+
insertafter: ^\s*limit =
23+
backrefs: false
24+
check_mode: false
25+
no_log: "{{ gitlab_runner_no_log_secrets | default(false) }}"
26+
notify:
27+
- restart_gitlab_runner
28+
- restart_gitlab_runner_macos
29+
when: gitlab_runner.request_concurrency is defined
30+
1631
- name: "Set coordinator URL {{ runn_name_prefix }}"
1732
ansible.builtin.lineinfile:
1833
dest: "{{ temp_runner_config.path }}"

templates/config.toml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ sentry_dsn = "{{ gitlab_runner_sentry_dsn }}"
3131
[[runners]]
3232
name = {{ gitlab_runner.name | tojson }}
3333
limit = {{ gitlab_runner.concurrent_specific | default(0) }}
34+
{% if gitlab_runner.request_concurrency is defined %}
35+
request_concurrency = {{ gitlab_runner.request_concurrency | tojson }}
36+
{% endif %}
3437
url = {{ gitlab_runner.url | default(gitlab_runner_coordinator_url) | tojson }}
3538
{% if gitlab_runner.clone_url is defined %}
3639
clone_url = {{ gitlab_runner.clone_url | tojson }}

0 commit comments

Comments
 (0)