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
Copy file name to clipboardExpand all lines: docs/additional_notes.md
+110
Original file line number
Diff line number
Diff line change
@@ -32,3 +32,113 @@ If default labels are removed:
32
32
| 'custom5' | Linux | no match |
33
33
| 'custom5' |[ self-hosted, Linux ]| no match |
34
34
| 'custom5' |[ custom5, self-hosted, Linux ]| no match |
35
+
36
+
# Exact Match
37
+
38
+
The multi-runner module has a setting `exactMatch` which affects how the matcherConfig functions.
39
+
40
+
The module will decide the runner for the workflow job based on the match in the labels defined in the workflow job and runner configuration. The runner configuration allows the match to be exact or non-exact match. We recommend to use only exact matches. For exact match, all the labels defined in the workflow should be present in the runner configuration matchers and for non-exact match, some of the labels in the workflow, when present in runner configuration, shall be enough for the runner configuration to be used for the job. First the exact matchers are applied, next the non exact ones.
41
+
42
+
Let's review examples of `exactMatch`.
43
+
44
+
Scenario 1:
45
+
46
+
Typical use case. Set `exactMatch` to true.
47
+
48
+
```
49
+
matcherConfig:
50
+
exactMatch: true
51
+
labelMatchers:
52
+
- [self-hosted, linux, x64, ubuntu-latest]
53
+
- [self-hosted, linux, x64, ubuntu-2204]
54
+
...
55
+
runner_config:
56
+
runner_extra_labels: "ubuntu-latest,ubuntu-2204"
57
+
...
58
+
```
59
+
60
+
GitHub Actions workflow:
61
+
62
+
```
63
+
runs-on: [self-hosted, linux, x64, ubuntu-latest]
64
+
```
65
+
66
+
Runners will launch, and the job will run successfully.
67
+
68
+
Scenario 2:
69
+
70
+
Set `exactMatch` to true. What happens if there are fewer label on the workflow than in the matcher?
71
+
72
+
```
73
+
matcherConfig:
74
+
exactMatch: false
75
+
labelMatchers:
76
+
- [self-hosted, linux, x64, ubuntu-latest]
77
+
- [self-hosted, linux, x64, ubuntu-2204]
78
+
...
79
+
runner_config:
80
+
runner_extra_labels: "ubuntu-latest,ubuntu-2204"
81
+
...
82
+
```
83
+
84
+
GitHub Actions workflow:
85
+
86
+
```
87
+
runs-on: [self-hosted, linux]
88
+
```
89
+
90
+
Runners will launch, and the job will run successfully.
91
+
92
+
Note: This may be a surprising result since "self-hosted, linux" does not look like what you would ordinarily think of as an 'exact match' of "self-hosted, linux, x64, ubuntu-latest".
93
+
94
+
A problem with this configuration is the "self-hosted, linux" jobs might consume runners that were really intended for "self-hosted, linux, x64, ubuntu-latest" jobs, leaving those jobs without runners. For this reason, it's not recommended.
95
+
96
+
Scenario 3:
97
+
98
+
Set `exactMatch` to true. What happens if there are more label on the workflow than in the matcher?
99
+
100
+
```
101
+
matcherConfig:
102
+
exactMatch: true
103
+
labelMatchers:
104
+
- [self-hosted, linux, x64]
105
+
...
106
+
runner_config:
107
+
runner_extra_labels: ""
108
+
...
109
+
```
110
+
111
+
GitHub Actions workflow:
112
+
113
+
```
114
+
runs-on: [self-hosted, linux, x64, ubuntu-latest]
115
+
```
116
+
117
+
`exactMatch` will prevent runners from launching. At least this is a correct outcome in the sense that GitHub would not provision jobs on runners with too few labels.
118
+
119
+
Scenario 4:
120
+
121
+
The same as 1, except set `exactMatch: false`.
122
+
123
+
All labels will happen to match (anyway). Runners will launch and the job will run successfully.
124
+
If you are planning to have exact matches it would be clearer to switch this to `exactMatch: true`.
125
+
126
+
Scenario 5:
127
+
128
+
The same as 2, except set `exactMatch: false`.
129
+
130
+
The same results and warnings as Scenario 2. Labels will happen to match (anyway). The jobs will run successfully, but might use runners that should be reserved for other jobs.
131
+
132
+
Scenario 6:
133
+
134
+
The same as 3, except set `exactMatch: false`.
135
+
136
+
Runners will launch. However, GitHub would not provision jobs on those runners with too few labels. This case should definitely be avoided (having runners launch, which GitHub will be unable to use).
137
+
138
+
A problem with `exactMatch: false` is that one of the main situations it enables is Scenario 6, which precisely should not happen.
139
+
140
+
---
141
+
142
+
In summary, all the examples with `exactMatch: false` are not recommended.
143
+
144
+
Mainly, only Scenario 1 includes an unambiguous, correct configuration.
0 commit comments