You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 16, 2025. It is now read-only.
feat(runners): add support to disable default labels (Linux) (#3491)
In case the pool of runners deployed using this module are fully
available for an wide GH org (no repository restrictions) any workflow
configured to run in runners that contain just default labels in the
runs-on definition:
e.g.
`runs-on: self-hosted`
`runs-on: Linux`
can end-up running in this pool without knowing it. That's why I have
decided to remove the default labels from our runners and just rely on
unique custom labels, and I believed the best way to do it by adding a
runner_enable_default_labels variable - that by default is true (so, it
doesn't change the current behavior), but it can help other people to
deal with similar issues like the one described above.
---------
Co-authored-by: Niek Palm <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Niek Palm <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -207,9 +207,10 @@ Talk to the forestkeepers in the `runners-channel` on Slack.
207
207
| <aname="input_runner_binaries_syncer_lambda_zip"></a> [runner\_binaries\_syncer\_lambda\_zip](#input\_runner\_binaries\_syncer\_lambda\_zip)| File location of the binaries sync lambda zip file. |`string`|`null`| no |
208
208
| <aname="input_runner_boot_time_in_minutes"></a> [runner\_boot\_time\_in\_minutes](#input\_runner\_boot\_time\_in\_minutes)| The minimum time for an EC2 runner to boot and register as a runner. |`number`|`5`| no |
209
209
| <aname="input_runner_credit_specification"></a> [runner\_credit\_specification](#input\_runner\_credit\_specification)| The credit option for CPU usage of a T instance. Can be unset, "standard" or "unlimited". |`string`|`null`| no |
210
+
| <aname="input_runner_disable_default_labels"></a> [runner\_disable\_default\_labels](#input\_runner\_disable\_default\_labels)| Disable default labels for the runners (os, architecture and `self-hosted`). If enabled, the runner will only have the extra labels provided in `runner_extra_labels`. In case you on own start script is used, this configuration parameter needs to be parsed via SSM. For Windows no support yet. |`bool`|`false`| no |
210
211
| <aname="input_runner_ec2_tags"></a> [runner\_ec2\_tags](#input\_runner\_ec2\_tags)| Map of tags that will be added to the launch template instance tag specifications. |`map(string)`|`{}`| no |
| <aname="input_runner_extra_labels"></a> [runner\_extra\_labels](#input\_runner\_extra\_labels)| Extra (custom) labels for the runners (GitHub). Labels checks on the webhook can be enforced by setting `enable_runner_workflow_job_labels_check_all`. GitHub read-only labels should not be provided. |`list(string)`|`[]`| no |
213
+
| <aname="input_runner_extra_labels"></a> [runner\_extra\_labels](#input\_runner\_extra\_labels)| Extra (custom) labels for the runners (GitHub). Separate each label by a comma. Labels checks on the webhook can be enforced by setting `enable_workflow_job_labels_check`. GitHub read-only labels should not be provided. |`list(string)`|`[]`| no |
213
214
| <aname="input_runner_group_name"></a> [runner\_group\_name](#input\_runner\_group\_name)| Name of the runner group. |`string`|`"Default"`| no |
214
215
| <aname="input_runner_iam_role_managed_policy_arns"></a> [runner\_iam\_role\_managed\_policy\_arns](#input\_runner\_iam\_role\_managed\_policy\_arns)| Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role |`list(string)`|`[]`| no |
215
216
| <aname="input_runner_log_files"></a> [runner\_log\_files](#input\_runner\_log\_files)| (optional) Replaces the module default cloudwatch log config. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html for details. | <pre>list(object({<br/> log_group_name = string<br/> prefix_log_group = bool<br/> file_path = string<br/> log_stream_name = string<br/> }))</pre> |`null`| no |
Copy file name to clipboardExpand all lines: docs/configuration.md
+9-6
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ To be able to support a number of use-cases, the module has quite a lot of confi
13
13
- GitHub Cloud vs GitHub Enterprise Server (GHES). The runners support GitHub Cloud as well GitHub Enterprise Server. For GHES, we rely on our community for support and testing. We at Philips have no capability to test GHES ourselves.
14
14
- Spot vs on-demand. The runners use either the EC2 spot or on-demand life cycle. Runners will be created via the AWS [CreateFleet API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateFleet.html). The module (scale up lambda) will request via the CreateFleet API to create instances in one of the subnets and of the specified instance types.
15
15
- ARM64 support via Graviton/Graviton2 instance-types. When using the default example or top-level module, specifying `instance_types` that match a Graviton/Graviton 2 (ARM64) architecture (e.g. a1, t4g or any 6th-gen `g` or `gd` type), you must also specify `runner_architecture = "arm64"` and the sub-modules will be automatically configured to provision with ARM64 AMIs and leverage GitHub's ARM64 action runner. See below for more details.
16
+
- Disable default labels for the runners (os, architecture and `self-hosted`) can achieve by setting `runner_disable_default_labels` = true. If enabled, the runner will only have the extra labels provided in `runner_extra_labels`. In case you on own start script is used, this configuration parameter needs to be parsed via SSM. For Windows no support yet.
16
17
17
18
## AWS SSM Parameters
18
19
@@ -24,14 +25,16 @@ The module uses the AWS System Manager Parameter Store to store configuration fo
24
25
|`ssm_paths.root/var.prefix?/runners/config/<name>`| Configuration parameters used by runner start script |
25
26
|`ssm_paths.root/var.prefix?/runners/tokens/<ec2-instance-id>`| Either JIT configuration (ephemeral runners) or registration tokens (non ephemeral runners) generated by the control plane (scale-up lambda), and consumed by the start script on the runner to activate / register the runner. |
26
27
|`ssm_paths.root/var.prefix?/webhook/runner-matcher-config`| Runner matcher config used by webhook to decide the target for the webhook event. |
runner_additional_security_group_ids: "List of additional security groups IDs to apply to the runner. If added outside the multi_runner_config block, the additional security group(s) will be applied to all runner configs. If added inside the multi_runner_config, the additional security group(s) will be applied to the individual runner."
165
166
runner_as_root: "Run the action runner under the root user. Variable `runner_run_as` will be ignored."
166
167
runner_boot_time_in_minutes: "The minimum time for an EC2 runner to boot and register as a runner."
168
+
runner_disable_default_labels: "Disable default labels for the runners (os, architecture and `self-hosted`). If enabled, the runner will only have the extra labels provided in `runner_extra_labels`. In case you on own start script is used, this configuration parameter needs to be parsed via SSM. For Windows no support yet."
167
169
runner_extra_labels: "Extra (custom) labels for the runners (GitHub). Separate each label by a comma. Labels checks on the webhook can be enforced by setting `multi_runner_config.matcherConfig.exactMatch`. GitHub read-only labels should not be provided."
168
170
runner_group_name: "Name of the runner group."
169
171
runner_name_prefix: "Prefix for the GitHub runner name."
| <aname="input_runner_architecture"></a> [runner\_architecture](#input\_runner\_architecture)| The platform architecture of the runner instance\_type. |`string`|`"x64"`| no |
200
201
| <aname="input_runner_as_root"></a> [runner\_as\_root](#input\_runner\_as\_root)| Run the action runner under the root user. Variable `runner_run_as` will be ignored. |`bool`|`false`| no |
201
202
| <aname="input_runner_boot_time_in_minutes"></a> [runner\_boot\_time\_in\_minutes](#input\_runner\_boot\_time\_in\_minutes)| The minimum time for an EC2 runner to boot and register as a runner. |`number`|`5`| no |
203
+
| <aname="input_runner_disable_default_labels"></a> [runner\_disable\_default\_labels](#input\_runner\_disable\_default\_labels)| Disable default labels for the runners (os, architecture and `self-hosted`). If enabled, the runner will only have the extra labels provided in `runner_extra_labels`. |`bool`|`false`| no |
202
204
| <aname="input_runner_ec2_tags"></a> [runner\_ec2\_tags](#input\_runner\_ec2\_tags)| Map of tags that will be added to the launch template instance tag specifications. |`map(string)`|`{}`| no |
203
205
| <aname="input_runner_group_name"></a> [runner\_group\_name](#input\_runner\_group\_name)| Name of the runner group. |`string`|`"Default"`| no |
204
206
| <aname="input_runner_iam_role_managed_policy_arns"></a> [runner\_iam\_role\_managed\_policy\_arns](#input\_runner\_iam\_role\_managed\_policy\_arns)| Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role |`list(string)`|`[]`| no |
description="Disable default labels for the runners (os, architecture and `self-hosted`). If enabled, the runner will only have the extra labels provided in `runner_extra_labels`."
222
+
type=bool
223
+
default=false
224
+
}
225
+
220
226
variable"runner_labels" {
221
227
description="All the labels for the runners (GitHub) including the default one's(e.g: self-hosted, linux, x64, label1, label2). Separate each label by a comma"
description="Disable default labels for the runners (os, architecture and `self-hosted`). If enabled, the runner will only have the extra labels provided in `runner_extra_labels`. In case you on own start script is used, this configuration parameter needs to be parsed via SSM. For Windows no support yet."
63
+
type=bool
64
+
default=false
65
+
}
66
+
61
67
variable"runner_extra_labels" {
62
-
description="Extra (custom) labels for the runners (GitHub). Labels checks on the webhook can be enforced by setting `enable_runner_workflow_job_labels_check_all`. GitHub read-only labels should not be provided."
68
+
description="Extra (custom) labels for the runners (GitHub). Separate each label by a comma. Labels checks on the webhook can be enforced by setting `enable_workflow_job_labels_check`. GitHub read-only labels should not be provided."
0 commit comments