Skip to content

Commit

Permalink
Add listen_address parameter
Browse files Browse the repository at this point in the history
Closes voxpupuli#46.
Fixes voxpupuli#26.
  • Loading branch information
baurmatt committed Dec 3, 2019
1 parent 73eb4d1 commit 1b98490
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
10 changes: 9 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ Default value: `undef`

Data type: `Optional[Pattern[/.*:.+/]]`

[host]:<port> to enable metrics server as described in https://docs.gitlab.com/runner/monitoring/README.html#configuration-of-the-metrics-http-server
(Deprecated) [host]:<port> to enable metrics server as described in https://docs.gitlab.com/runner/monitoring/README.html#configuration-of-the-metrics-http-server.

Default value: `undef`

##### `listen_address`

Data type: `Optional[Pattern[/.*:.+/]]`

Address (<host>:<port>) on which the Prometheus metrics HTTP server should be listening.

Default value: `undef`

Expand Down
14 changes: 13 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
# @param cache_dir
# Absolute path to a directory where build caches will be stored in context of selected executor (locally, Docker, SSH). If the docker executor is used, this directory needs to be included in its volumes parameter.
# @param metrics_server
# [host]:<port> to enable metrics server as described in https://docs.gitlab.com/runner/monitoring/README.html#configuration-of-the-metrics-http-server
# (Deprecated) [host]:<port> to enable metrics server as described in https://docs.gitlab.com/runner/monitoring/README.html#configuration-of-the-metrics-http-server.
# @param listen_address
# Address (<host>:<port>) on which the Prometheus metrics HTTP server should be listening.
# @param sentry_dsn
# Enable tracking of all system level errors to sentry.
# @param manage_docker
Expand All @@ -50,6 +52,7 @@
Optional[String] $builds_dir = undef,
Optional[String] $cache_dir = undef,
Optional[Pattern[/.*:.+/]] $metrics_server = undef,
Optional[Pattern[/.*:.+/]] $listen_address = undef,
Optional[String] $sentry_dsn = undef,
Boolean $manage_docker = true,
Boolean $manage_repo = true,
Expand Down Expand Up @@ -159,6 +162,15 @@
notify => Service[$package_name],
}
}
if $listen_address {
file_line { 'gitlab-runner-listen-address':
path => $config_path,
line => "listen_address = \"${listen_address}\"",
match => '^listen_address = .+',
require => Package[$package_name],
notify => Service[$package_name],
}
}
if $builds_dir {
file_line { 'gitlab-runner-builds_dir':
path => $config_path,
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/gitlab_ci_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,26 @@
'match' => '^metrics_server = .+')
end
end
context 'with listen_address => localhost:9252' do
let(:params) do
{
'runner_defaults' => {},
'runners' => {},
'listen_address' => 'localhost:9252'
}
end

it do
is_expected.to contain_file_line('gitlab-runner-listen-address').
with(
path: '/etc/gitlab-runner/config.toml',
line: 'listen_address = "localhost:9252"',
match: '^listen_address = .+'
).
that_requires("Package[#{package_name}]").
that_notifies("Service[#{package_name}]")
end
end
context 'with builds_dir => /tmp/builds_dir' do
let(:params) do
{
Expand Down

0 comments on commit 1b98490

Please sign in to comment.