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

Commit 04dad83

Browse files
authored
Merge pull request #15 from Telefonica/add_proxy_support
Add proxy support
2 parents a127851 + abd9dde commit 04dad83

File tree

8 files changed

+250
-46
lines changed

8 files changed

+250
-46
lines changed

.github/workflows/pdk-test-unit.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,31 @@ on:
55
- pull_request
66

77
jobs:
8+
validating:
9+
runs-on: self-hosted-novum
10+
steps:
11+
- name: Clone repository
12+
uses: actions/checkout@v2
13+
14+
- name: Run pdk validate
15+
uses: puppets-epic-show-theatre/action-pdk-validate@v1
16+
with:
17+
# [optional]
18+
# A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".
19+
puppet-version: "5.5"
20+
821
testing:
922
runs-on: self-hosted-novum
23+
if: always()
24+
needs:
25+
- validating
1026
steps:
1127
- name: Clone repository
1228
uses: actions/checkout@v2
1329

1430
- name: Run unit tests
1531
uses: puppets-epic-show-theatre/action-pdk-test-unit@v1
32+
# added because there are open ended dependencies version requirements in metadata.json
1633
with:
1734
# [optional]
1835
# A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5".

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.git/
2+
.*.sw[op]
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/spec/fixtures/manifests/
19+
/spec/fixtures/modules/
20+
/tmp/
21+
/vendor/
22+
/convert_report.txt
23+
/update_report.txt
24+
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ github_actions_runner::instances:
6060
personal_access_token: other_secret
6161
```
6262
63+
In case you need to set proxy in one instance:
64+
```yaml
65+
github_actions_runner::ensure: present
66+
github_actions_runner::base_dir_name: '/data/actions-runner'
67+
github_actions_runner::package_name: 'actions-runner-linux-x64'
68+
github_actions_runner::package_ensure: '2.272.0'
69+
github_actions_runner::repository_url: 'https://github.com/actions/runner/releases/download'
70+
github_actions_runner::org_name: 'github_org'
71+
github_actions_runner::personal_access_token: 'PAT'
72+
github_actions_runner::user: 'root'
73+
github_actions_runner::group: 'root'
74+
github_actions_runner::instances:
75+
first_instance:
76+
http_proxy: http://proxy.local
77+
https_proxy: http://proxy.local
78+
no_proxy: example.com
79+
labels:
80+
- self-hosted-custom1
81+
```
6382
6483
## Limitations
6584

manifests/init.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@
3434
# * group
3535
# String, Group to be used in Service and directories.
3636
#
37+
# * instances
38+
# Hash[String, Hash], Github Runner Instances to be managed.
39+
#
40+
# * http_proxy
41+
# 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.
42+
#
43+
# * https_proxy
44+
# Optional[String], Proxy URL for HTTPS traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners
45+
#
46+
# * no_proxy
47+
# Optional[String], Comma separated list of hosts that should not use a proxy. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners
48+
#
3749

3850
class github_actions_runner (
3951
Enum['present', 'absent'] $ensure,
@@ -46,6 +58,9 @@
4658
String $user,
4759
String $group,
4860
Hash[String, Hash] $instances,
61+
Optional[String] $http_proxy = undef,
62+
Optional[String] $https_proxy = undef,
63+
Optional[String] $no_proxy = undef,
4964
) {
5065

5166
$root_dir = "${github_actions_runner::base_dir_name}-${github_actions_runner::package_ensure}"

manifests/instance.pp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
# * instance_name
2424
# String, The instance name as part of the instances Hash.
2525
#
26+
# * http_proxy
27+
# 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.
28+
#
29+
# * https_proxy
30+
# Optional[String], Proxy URL for HTTPS traffic. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners
31+
#
32+
# * no_proxy
33+
# Optional[String], Comma separated list of hosts that should not use a proxy. More information at https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners
34+
#
2635
# * repo_name
2736
# Optional[String], actions runner repository name.
2837
#
@@ -38,6 +47,9 @@
3847
String $group = $github_actions_runner::group,
3948
String $hostname = $::facts['hostname'],
4049
String $instance_name = $title,
50+
Optional[String] $http_proxy = $github_actions_runner::http_proxy,
51+
Optional[String] $https_proxy = $github_actions_runner::https_proxy,
52+
Optional[String] $no_proxy = $github_actions_runner::no_proxy,
4153
Optional[Array[String]] $labels = undef,
4254
Optional[String] $repo_name = undef,
4355

@@ -110,7 +122,7 @@
110122

111123
exec { "${instance_name}-ownership":
112124
user => $user,
113-
cwd => "${github_actions_runner::root_dir}",
125+
cwd => $github_actions_runner::root_dir,
114126
command => "/bin/chown -R ${user}:${group} ${github_actions_runner::root_dir}/${instance_name}",
115127
refreshonly => true,
116128
path => "/tmp/${instance_name}-${archive_name}",
@@ -131,6 +143,9 @@
131143
root_dir => $github_actions_runner::root_dir,
132144
user => $user,
133145
group => $group,
146+
http_proxy => $http_proxy,
147+
https_proxy => $https_proxy,
148+
no_proxy => $no_proxy,
134149
}),
135150
require => [File["${github_actions_runner::root_dir}/${instance_name}/configure_install_runner.sh"],
136151
Exec["${instance_name}-run_configure_install_runner.sh"]],

metadata.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "telefonica-github_actions_runner",
3-
"version": "0.2.4",
3+
"version": "0.3.0",
44
"author": "Shimon Ohayon",
55
"summary": "Module to configure our GitHub Actions runner on Debian hosts",
66
"license": "Apache-2.0",
@@ -10,15 +10,15 @@
1010
"dependencies": [
1111
{
1212
"name": "puppetlabs-stdlib",
13-
"version_requirement": ">= 1.0.0"
13+
"version_requirement": ">= 1.0.0 < 7.0.0"
1414
},
1515
{
1616
"name": "camptocamp/systemd",
17-
"version_requirement": ">= 1.1.1"
17+
"version_requirement": ">= 1.1.1 < 3.0.0"
1818
},
1919
{
2020
"name": "puppet-archive",
21-
"version_requirement": ">= 1.1.2"
21+
"version_requirement": ">= 1.1.2 < 5.0.0"
2222
}
2323
],
2424
"data_provider": "hiera",

0 commit comments

Comments
 (0)