|
42 | 42 | # Optional[Array[String]], A list of costum lables to add to a runner. |
43 | 43 | # |
44 | 44 | # * path |
45 | | -# Optional[Array[String]], List of paths to be used as PATH env in the instance runner. If not defined, this file will be kept as created |
| 45 | +# 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 |
46 | 46 | # by the runner scripts. (Default: Value set by github_actions_runner Class) |
47 | 47 | # |
| 48 | +# * env |
| 49 | +# Optional[Hash[String, String]], List of variables to be used as env variables in the instance runner. |
| 50 | +# If not defined, file ".env" will be kept as created |
| 51 | +# by the runner scripts. (Default: Value set by github_actions_runner Class) |
| 52 | +# |
48 | 53 | define github_actions_runner::instance ( |
49 | | - Enum['present', 'absent'] $ensure = 'present', |
50 | | - String[1] $personal_access_token = $github_actions_runner::personal_access_token, |
51 | | - String[1] $user = $github_actions_runner::user, |
52 | | - String[1] $group = $github_actions_runner::group, |
53 | | - String[1] $hostname = $::facts['hostname'], |
54 | | - String[1] $instance_name = $title, |
55 | | - String[1] $github_domain = $github_actions_runner::github_domain, |
56 | | - String[1] $github_api = $github_actions_runner::github_api, |
57 | | - Optional[String[1]] $http_proxy = $github_actions_runner::http_proxy, |
58 | | - Optional[String[1]] $https_proxy = $github_actions_runner::https_proxy, |
59 | | - Optional[String[1]] $no_proxy = $github_actions_runner::no_proxy, |
60 | | - Optional[Array[String[1]]] $labels = undef, |
61 | | - Optional[String[1]] $enterprise_name = $github_actions_runner::enterprise_name, |
62 | | - Optional[String[1]] $org_name = $github_actions_runner::org_name, |
63 | | - Optional[String[1]] $repo_name = undef, |
64 | | - Optional[Array[String]] $path = $github_actions_runner::path, |
| 54 | + Enum['present', 'absent'] $ensure = 'present', |
| 55 | + String[1] $personal_access_token = $github_actions_runner::personal_access_token, |
| 56 | + String[1] $user = $github_actions_runner::user, |
| 57 | + String[1] $group = $github_actions_runner::group, |
| 58 | + String[1] $hostname = $::facts['hostname'], |
| 59 | + String[1] $instance_name = $title, |
| 60 | + String[1] $github_domain = $github_actions_runner::github_domain, |
| 61 | + String[1] $github_api = $github_actions_runner::github_api, |
| 62 | + Optional[String[1]] $http_proxy = $github_actions_runner::http_proxy, |
| 63 | + Optional[String[1]] $https_proxy = $github_actions_runner::https_proxy, |
| 64 | + Optional[String[1]] $no_proxy = $github_actions_runner::no_proxy, |
| 65 | + Optional[Array[String[1]]] $labels = undef, |
| 66 | + Optional[String[1]] $enterprise_name = $github_actions_runner::enterprise_name, |
| 67 | + Optional[String[1]] $org_name = $github_actions_runner::org_name, |
| 68 | + Optional[String[1]] $repo_name = undef, |
| 69 | + Optional[Array[String]] $path = $github_actions_runner::path, |
| 70 | + Optional[Hash[String, String]] $env = $github_actions_runner::env, |
65 | 71 | ) { |
66 | 72 |
|
67 | 73 | if $labels { |
|
183 | 189 | notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"] |
184 | 190 | } |
185 | 191 |
|
| 192 | + $content_env = $env ? { |
| 193 | + undef => undef, |
| 194 | + default => epp('github_actions_runner/env.epp', { |
| 195 | + envs => $env, |
| 196 | + }) |
| 197 | + } |
| 198 | + |
| 199 | + file { "${github_actions_runner::root_dir}/${name}/.env": |
| 200 | + ensure => $ensure, |
| 201 | + mode => '0644', |
| 202 | + owner => $user, |
| 203 | + group => $group, |
| 204 | + content => $content_env, |
| 205 | + require => [Archive["${instance_name}-${archive_name}"], |
| 206 | + Exec["${instance_name}-run_configure_install_runner.sh"], |
| 207 | + ], |
| 208 | + notify => Systemd::Unit_file["github-actions-runner.${instance_name}.service"] |
| 209 | + } |
| 210 | + |
186 | 211 | $active_service = $ensure ? { |
187 | 212 | 'present' => true, |
188 | 213 | 'absent' => false, |
|
0 commit comments