Skip to content

Commit 153e206

Browse files
committed
Add parameters to apt::source to avoid requiring an internet connexion
Signed-off-by: Cedric Couralet <[email protected]> Signed-off-by: Cédric Couralet <[email protected]>
1 parent 5de3a87 commit 153e206

File tree

2 files changed

+58
-20
lines changed

2 files changed

+58
-20
lines changed

manifests/init.pp

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
# The name of the package.
4242
# @param repo_base_url
4343
# The base repository url.
44+
# @param repo_keyid
45+
# Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal
46+
# characters, optionally prefixed with "0x") or a full key fingerprint (40 hexadecimal characters).
4447
# @param repo_keyserver
4548
# The keyserver which should be used to get the repository key.
4649
# @param repo_keycontent
@@ -54,26 +57,27 @@
5457
# The path to the config file of Gitlab runner.
5558
#
5659
class gitlab_ci_runner (
57-
String $xz_package_name, # Defaults in module hieradata
58-
Hash $runners = {},
59-
Hash $runner_defaults = {},
60-
Optional[Integer] $concurrent = undef,
61-
Optional[Integer] $check_interval = undef,
62-
Optional[String] $builds_dir = undef,
63-
Optional[String] $cache_dir = undef,
64-
Optional[Pattern[/.*:.+/]] $metrics_server = undef,
65-
Optional[Pattern[/.*:.+/]] $listen_address = undef,
66-
Optional[String] $sentry_dsn = undef,
67-
Boolean $manage_docker = false,
68-
Boolean $manage_repo = true,
69-
String $package_ensure = installed,
70-
String $package_name = 'gitlab-runner',
71-
Stdlib::HTTPUrl $repo_base_url = 'https://packages.gitlab.com',
72-
Optional[Stdlib::Fqdn] $repo_keyserver = undef,
73-
Optional[String] $repo_keycontent = undef,
74-
Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $repo_keysource = undef,
75-
Boolean $repo_keyweak_ssl = false,
76-
String $config_path = '/etc/gitlab-runner/config.toml',
60+
String $xz_package_name, # Defaults in module hieradata
61+
Hash $runners = {},
62+
Hash $runner_defaults = {},
63+
Optional[Integer] $concurrent = undef,
64+
Optional[Integer] $check_interval = undef,
65+
Optional[String] $builds_dir = undef,
66+
Optional[String] $cache_dir = undef,
67+
Optional[Pattern[/.*:.+/]] $metrics_server = undef,
68+
Optional[Pattern[/.*:.+/]] $listen_address = undef,
69+
Optional[String] $sentry_dsn = undef,
70+
Boolean $manage_docker = false,
71+
Boolean $manage_repo = true,
72+
String $package_ensure = installed,
73+
String $package_name = 'gitlab-runner',
74+
Stdlib::HTTPUrl $repo_base_url = 'https://packages.gitlab.com',
75+
Optional[Pattern[/\A(0x)?[0-9a-fA-F]{8}\Z/, /\A(0x)?[0-9a-fA-F]{16}\Z/, /\A(0x)?[0-9a-fA-F]{40}\Z/]] $repo_keyid = undef,
76+
Optional[Stdlib::Fqdn] $repo_keyserver = undef,
77+
Optional[String] $repo_keycontent = undef,
78+
Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $repo_keysource = undef,
79+
Boolean $repo_keyweak_ssl = false,
80+
String $config_path = '/etc/gitlab-runner/config.toml',
7781
) {
7882
if $manage_docker {
7983
# workaround for cirunner issue #1617

spec/classes/gitlab_ci_runner_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,40 @@
298298
end
299299
end
300300
end
301+
if facts[:os]['family'] == 'Debian'
302+
context 'with manage_repo => true and repo_keysource => http://path.to/gpg.key' do
303+
let(:params) do
304+
super().merge(
305+
manage_repo: true,
306+
repo_keysource: 'http://path.to/gpg.key'
307+
)
308+
end
309+
310+
it { is_expected.to compile }
311+
it { is_expected.to contain_class('gitlab_ci_runner::repo') }
312+
313+
it do
314+
is_expected.to contain_apt__source('apt_gitlabci').with_key('id' => 'F6403F6544A38863DAA0B6E03F01618A51312F3F', 'source' => 'http://path.to/gpg.key')
315+
end
316+
end
317+
end
318+
if facts[:os]['family'] == 'Debian'
319+
context 'with manage_repo => true and repo_keycontent => "somebase64encodedContent"' do
320+
let(:params) do
321+
super().merge(
322+
manage_repo: true,
323+
repo_keycontent: 'somebase64encodedContent'
324+
)
325+
end
326+
327+
it { is_expected.to compile }
328+
it { is_expected.to contain_class('gitlab_ci_runner::repo') }
329+
330+
it do
331+
is_expected.to contain_apt__source('apt_gitlabci').with_key('id' => 'F6403F6544A38863DAA0B6E03F01618A51312F3F', 'content' => 'somebase64encodedContent')
332+
end
333+
end
334+
end
301335
end
302336
end
303337
end

0 commit comments

Comments
 (0)