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

Commit dc1b86c

Browse files
committed
Added documentation and tests
1 parent 1ceaa30 commit dc1b86c

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ github_actions_runner::instances:
8080
- self-hosted-custom1
8181
```
8282
83+
In case you are using Github Enterprise Server , you can define these two parameters to specify the correct urls:
84+
```yaml
85+
github_actions_runner::github_domain: "https://git.example.com"
86+
github_actions_runner::github_api: "https://git.example.com/api/v3"
87+
```
88+
8389
## Limitations
8490
8591
Tested on Debian 9 stretch hosts only.

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
# * instances
3838
# Hash[String, Hash], Github Runner Instances to be managed.
3939
#
40+
# * github_domain
41+
# String, Base URL for Github Domain.
42+
#
43+
# * github_api
44+
# String, Base URL for Github API.
45+
#
4046
# * http_proxy
4147
# Optional[String], Proxy URL for HTTP traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners.
4248
#

spec/classes/github_actions_runner_spec.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,52 @@
293293
is_expected.to contain_systemd__unit_file('github-actions-runner.first_runner.service').without_content(%r{Environment="no_proxy=example.com"})
294294
end
295295
end
296+
297+
context 'is expected to create a github_actions_runner installation with another URLs for domain and API' do
298+
let(:params) do
299+
super().merge(
300+
'github_domain' => 'https://git.example.com',
301+
'github_api' => 'https://git.example.com/api/v3',
302+
'instances' => {
303+
'first_runner' => {
304+
'labels' => ['test_label1'],
305+
'repo_name' => 'test_repo',
306+
},
307+
},
308+
)
309+
end
310+
311+
it do
312+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--url https://git.example.com})
313+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{https://git.example.com/api/v3.* \| jq -r .token})
314+
end
315+
end
316+
317+
context 'is expected to create a github_actions_runner installation with another URLs for domain and API per instance' do
318+
let(:params) do
319+
super().merge(
320+
'instances' => {
321+
'first_runner' => {
322+
'labels' => ['test_label1'],
323+
'repo_name' => 'test_repo',
324+
},
325+
'second_runner' => {
326+
'labels' => ['test_label1'],
327+
'repo_name' => 'test_repo',
328+
'github_domain' => 'https://git.example.foo',
329+
'github_api' => 'https://git.example.foo/api/v2',
330+
},
331+
},
332+
)
333+
end
334+
335+
it do
336+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{--url https://github.com})
337+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/first_runner/configure_install_runner.sh').with_content(%r{https://api.github.com/.* \| jq -r .token})
338+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/second_runner/configure_install_runner.sh').with_content(%r{--url https://git.example.foo})
339+
is_expected.to contain_file('/some_dir/actions-runner-2.272.0/second_runner/configure_install_runner.sh').with_content(%r{https://git.example.foo/api/v2/.* \| jq -r .token})
340+
end
341+
end
296342
end
297343
end
298344
end

0 commit comments

Comments
 (0)