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

Commit 6fd6dcf

Browse files
committed
Support adding runner to runner groups
Allow a per instance `runner_group` to be specified to pupulate the `--runnergroup` option to `config.sh` * https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups
1 parent 7c1e1bb commit 6fd6dcf

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ github_actions_runner::instances:
3636
example_org_instance:
3737
labels:
3838
- self-hosted-custom
39+
runner_group: 'MyRunners'
3940
```
4041
4142
Note, your `personal_access_token` has to contain the `admin:org` permission.

manifests/instance.pp

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
# * labels
4545
# Optional[Array[String]], A list of costum lables to add to a runner.
4646
#
47+
# * runner_group
48+
# Optional[String[1]], The github runner group to add the runner to.
4749
# * path
4850
# Optional[Array[String]], List of paths to be used as PATH env in the instance runner. If not defined, file ".path" will be kept as created
4951
# by the runner scripts. (Default: Value set by github_actions_runner Class)
@@ -67,6 +69,7 @@
6769
Optional[String[1]] $no_proxy = $github_actions_runner::no_proxy,
6870
Optional[Boolean] $disable_update = $github_actions_runner::disable_update,
6971
Optional[Array[String[1]]] $labels = undef,
72+
Optional[String[1]] $runner_group = undef,
7073
Optional[String[1]] $enterprise_name = $github_actions_runner::enterprise_name,
7174
Optional[String[1]] $org_name = $github_actions_runner::org_name,
7275
Optional[String[1]] $repo_name = undef,
@@ -139,6 +142,7 @@
139142
url => $url,
140143
hostname => $hostname,
141144
assured_labels => $assured_labels,
145+
runner_group => $runner_group,
142146
disable_update => $disable_update,
143147
}),
144148
notify => Exec["${instance_name}-run_configure_install_runner.sh"],

templates/configure_install_runner.sh.epp

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
String $url,
66
String $hostname,
77
String $assured_labels,
8+
Optional[String[1]] $runner_group = undef,
89
Boolean $disable_update,
910
| -%>
1011
#!/bin/bash
@@ -33,6 +34,9 @@ export RUNNER_ALLOW_RUNASROOT=true
3334
--name <%= $hostname %>-<%= $instance_name %> \
3435
--url <%= $url %> \
3536
--token ${TOKEN} \
37+
<%- if $runner_group -%>
38+
--runnergroup <%= $runner_group %> \
39+
<%- } -%>
3640
<%- if $disable_update { -%>
3741
--disableupdate \
3842
<%- } -%>

0 commit comments

Comments
 (0)