Skip to content

Commit 6d5d99a

Browse files
authored
docs: Document using labels with self-hosted runners (#3508)
Explanation of issue: There are many popular CI systems that exist out in the world, not only GitHub Actions. It's probably common enough that a developer comes to this project and needs to configure the Terraform runners with GitHub Actions, while also having in their mind how other systems operate, and those may be different. It's easy to imagine all runner labels must match all job labels. Other systems are designed that way. To quickly solve the problem this is a sort of cheatsheet.
1 parent 0865273 commit 6d5d99a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A logical question would be, why not Kubernetes? In the current approach, we sta
5555

5656
## Overview
5757

58-
The moment a GitHub action workflow requiring a `self-hosted` runner is triggered, GitHub will try to find a runner which can execute the workload. This module reacts to GitHub's [`workflow_job` event](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#workflow_job) for the triggered workflow and creates a new runner if necessary.
58+
The moment a GitHub action workflow requiring a `self-hosted` runner is triggered, GitHub will try to find a runner which can execute the workload. See [additional notes](docs/additional_notes.md) for how the selection is made. This module reacts to GitHub's [`workflow_job` event](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#workflow_job) for the triggered workflow and creates a new runner if necessary.
5959

6060
For receiving the `workflow_job` event by the webhook (lambda), a webhook needs to be created in GitHub. The `check_run` option was dropped from version 2.x. The following options to send the event are supported.
6161

docs/additional_notes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# Runner Labels
3+
4+
Some CI systems require that all labels match between a job and a runner. In the case of GitHub Actions, workflows will be assigned to runners which have all the labels requested by the workflow, however it is not necessary the workflow mentions all labels.
5+
6+
Labels specify the capabilities the runners have. The labels in the workflow are the capabilities needed. If the capabilities requested by the workflow are provided by the runners, there is match.
7+
8+
Examples:
9+
10+
| Runner Labels | Workflow runs-on: | Result |
11+
| ------------- | ------------- | ------------- |
12+
| 'self-hosted', 'Linux', 'X64' | self-hosted | matches |
13+
| 'self-hosted', 'Linux', 'X64' | Linux | matches |
14+
| 'self-hosted', 'Linux', 'X64' | X64 | matches |
15+
| 'self-hosted', 'Linux', 'X64' | [ self-hosted, Linux ] | matches |
16+
| 'self-hosted', 'Linux', 'X64' | [ self-hosted, X64 ] | matches |
17+
| 'self-hosted', 'Linux', 'X64' | [ self-hosted, Linux, X64 ] | matches |
18+
| 'self-hosted', 'Linux', 'X64' | other1 | no match |
19+
| 'self-hosted', 'Linux', 'X64' | [ self-hosted, other2 ] | no match |
20+
| 'self-hosted', 'Linux', 'X64' | [ self-hosted, Linux, X64, other2 ] | no match |
21+
| 'self-hosted', 'Linux', 'X64', 'custom3' | custom3 | matches |
22+
| 'self-hosted', 'Linux', 'X64', 'custom3' | [ custom3, Linux ] | matches |
23+
| 'self-hosted', 'Linux', 'X64', 'custom3' | [ custom3, X64 ] | matches |
24+
| 'self-hosted', 'Linux', 'X64', 'custom3' | [ custom3, other7 ] | no match |
25+
26+
If default labels are removed:
27+
28+
| Runner Labels | Workflow runs-on: | Result |
29+
| ------------- | ------------- | ------------- |
30+
| 'custom5' | custom5 | matches |
31+
| 'custom5' | self-hosted | no match |
32+
| 'custom5' | Linux | no match |
33+
| 'custom5' | [ self-hosted, Linux ] | no match |
34+
| 'custom5' | [ custom5, self-hosted, Linux ] | no match |

0 commit comments

Comments
 (0)