Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 79f3d35

Browse files
authored
Merge branch 'Telefonica:master' into enterprise_support
2 parents 9a4f31f + 5ae5dcc commit 79f3d35

File tree

4 files changed

+73
-26
lines changed

4 files changed

+73
-26
lines changed

.fixtures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fixtures:
1010
ref: "v1.1.2"
1111
systemd:
1212
repo: "https://github.com/camptocamp/puppet-systemd.git"
13-
ref: "1.1.1"
13+
ref: "2.7.0"
1414

1515

manifests/instance.pp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,20 @@
150150
refreshonly => true
151151
}
152152

153+
$active_service = $ensure ? {
154+
'present' => true,
155+
'absent' => false,
156+
}
157+
158+
$enable_service = $ensure ? {
159+
'present' => true,
160+
'absent' => false,
161+
}
162+
153163
systemd::unit_file { "github-actions-runner.${instance_name}.service":
154164
ensure => $ensure,
165+
enable => $enable_service,
166+
active => $active_service,
155167
content => epp('github_actions_runner/github-actions-runner.service.epp', {
156168
instance_name => $instance_name,
157169
root_dir => $github_actions_runner::root_dir,
@@ -163,23 +175,6 @@
163175
}),
164176
require => [File["${github_actions_runner::root_dir}/${instance_name}/configure_install_runner.sh"],
165177
Exec["${instance_name}-run_configure_install_runner.sh"]],
166-
notify => Service["github-actions-runner.${instance_name}.service"],
167-
}
168-
169-
$ensure_service = $ensure ? {
170-
'present' => running,
171-
'absent' => stopped,
172-
}
173-
174-
$enable_service = $ensure ? {
175-
'present' => true,
176-
'absent' => false,
177-
}
178-
179-
service { "github-actions-runner.${instance_name}.service":
180-
ensure => $ensure_service,
181-
enable => $enable_service,
182-
require => Class['systemd::systemctl::daemon_reload'],
183178
}
184179

185180
}

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "telefonica-github_actions_runner",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"author": "Shimon Ohayon",
55
"summary": "Module to configure our GitHub Actions runner on Debian hosts",
66
"license": "Apache-2.0",
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"name": "camptocamp/systemd",
17-
"version_requirement": ">= 1.1.1 < 3.0.0"
17+
"version_requirement": ">= 2.7.0 < 3.0.0"
1818
},
1919
{
2020
"name": "puppet-archive",

spec/classes/github_actions_runner_spec.rb

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@
8787
end
8888
end
8989

90-
context 'is expected to create a github_actions_runner service' do
91-
it do
92-
is_expected.to contain_service('github-actions-runner.first_runner.service').with('ensure' => 'running', 'enable' => true)
93-
end
94-
end
95-
9690
context 'is expected to contain archive' do
9791
it do
9892
is_expected.to contain_archive('first_runner-actions-runner-linux-x64-2.272.0.tar.gz').with(
@@ -208,6 +202,64 @@
208202
end
209203
end
210204

205+
context 'is expected to create a github_actions_runner with service active and enabled' do
206+
let(:params) do
207+
super().merge(
208+
'http_proxy' => 'http://proxy.local',
209+
'https_proxy' => 'http://proxy.local',
210+
'no_proxy' => 'example.com',
211+
'instances' => {
212+
'first_runner' => {
213+
'labels' => ['test_label1'],
214+
'repo_name' => 'test_repo',
215+
},
216+
},
217+
)
218+
end
219+
220+
it do
221+
is_expected.to contain_systemd__unit_file('github-actions-runner.first_runner.service').with(
222+
'ensure' => 'present',
223+
'enable' => true,
224+
'active' => true,
225+
)
226+
end
227+
end
228+
229+
context 'is expected to remove github_actions_runner unit_file and other resources' do
230+
let(:params) do
231+
super().merge(
232+
'http_proxy' => 'http://proxy.local',
233+
'https_proxy' => 'http://proxy.local',
234+
'no_proxy' => 'example.com',
235+
'instances' => {
236+
'first_runner' => {
237+
'ensure' => 'absent',
238+
'labels' => ['test_label1'],
239+
'repo_name' => 'test_repo',
240+
},
241+
},
242+
)
243+
end
244+
245+
it do
246+
is_expected.to contain_systemd__unit_file('github-actions-runner.first_runner.service').with(
247+
'ensure' => 'absent',
248+
'enable' => false,
249+
'active' => false,
250+
)
251+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner').with(
252+
'ensure' => 'absent',
253+
)
254+
is_expected.to contain_archive('first_runner-actions-runner-linux-x64-2.272.0.tar.gz').with(
255+
'ensure' => 'absent',
256+
)
257+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with(
258+
'ensure' => 'absent',
259+
)
260+
end
261+
end
262+
211263
context 'is expected to create a github_actions_runner installation with proxy settings in systemd globally in init.pp' do
212264
let(:params) do
213265
super().merge(

0 commit comments

Comments
 (0)