Skip to content

Commit 0c0f28b

Browse files
authored
Merge pull request #91 from tuxmea/manage_check_interval
Allow management of check_interval config setting
2 parents cf023d0 + b022a0a commit 0c0f28b

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ To use the Gitlab CI runners it is required to have the [puppetlabs/docker](http
2727
```yaml
2828
gitlab_ci_runner::concurrent: 4
2929

30+
gitlab_ci_runner::check_interval: 4
31+
3032
gitlab_ci_runner::metrics_server: "localhost:8888"
3133

3234
gitlab_ci_runner::manage_docker: true

manifests/config.pp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class gitlab_ci_runner::config (
66
$config_path = $gitlab_ci_runner::config_path,
77
$concurrent = $gitlab_ci_runner::concurrent,
8+
$check_interval = $gitlab_ci_runner::check_interval,
89
$metrics_server = $gitlab_ci_runner::metrics_server,
910
$listen_address = $gitlab_ci_runner::listen_address,
1011
$builds_dir = $gitlab_ci_runner::builds_dir,
@@ -28,6 +29,14 @@
2829
}
2930
}
3031

32+
if $check_interval {
33+
file_line { 'gitlab-runner-check-interval':
34+
path => $config_path,
35+
line => "check_interval = ${check_interval}",
36+
match => '^check_interval = \d+',
37+
}
38+
}
39+
3140
if $metrics_server {
3241
file_line { 'gitlab-runner-metrics_server':
3342
path => $config_path,

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# The name of the 'xz' package. Needed for local docker installations.
2020
# @param concurrent
2121
# Limits how many jobs globally can be run concurrently. The most upper limit of jobs using all defined runners. 0 does not mean unlimited!
22+
# @param check_interval
23+
# Integer which defines the interval length, in seconds, between new jobs check. If not set via Puppet the default value is 3; if set to 0 or lower, GitLab runner will use the default value.
2224
# @param builds_dir
2325
# Absolute path to a directory where builds will be stored in context of selected executor (Locally, Docker, SSH).
2426
# @param cache_dir
@@ -49,6 +51,7 @@
4951
Hash $runners = {},
5052
Hash $runner_defaults = {},
5153
Optional[Integer] $concurrent = undef,
54+
Optional[Integer] $check_interval = undef,
5255
Optional[String] $builds_dir = undef,
5356
Optional[String] $cache_dir = undef,
5457
Optional[Pattern[/.*:.+/]] $metrics_server = undef,

spec/classes/gitlab_ci_runner_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
it { is_expected.to contain_file('/etc/gitlab-runner/config.toml') }
4040

4141
it { is_expected.not_to contain_file_line('gitlab-runner-concurrent') }
42+
it { is_expected.not_to contain_file_line('gitlab-runner-check-interval') }
4243
it { is_expected.not_to contain_file_line('gitlab-runner-metrics_server') }
4344
it { is_expected.not_to contain_file_line('gitlab-runner-builds_dir') }
4445
it { is_expected.not_to contain_file_line('gitlab-runner-cache_dir') }
@@ -58,6 +59,21 @@
5859
'match' => '^concurrent = \d+')
5960
end
6061
end
62+
context 'with check_interval => 10' do
63+
let(:params) do
64+
{
65+
'runner_defaults' => {},
66+
'runners' => {},
67+
'check_interval' => 10
68+
}
69+
end
70+
71+
it do
72+
is_expected.to contain_file_line('gitlab-runner-check-interval').with('path' => '/etc/gitlab-runner/config.toml',
73+
'line' => 'check_interval = 10',
74+
'match' => '^check_interval = \d+')
75+
end
76+
end
6177
context 'with metrics_server => localhost:9252' do
6278
let(:params) do
6379
{

0 commit comments

Comments
 (0)