1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
"""The runner-placement judgement: where a lane runs, and for how long.
Ubicloud's cache proxy is scoped by ref, and a pull request from a fork
cannot obtain an Ubicloud runner at all. A lane that names an Ubicloud
runner therefore selects it by an expression that falls back to the
hosted pool for a fork, and states its own ceiling, because an Ubicloud
runner is a self-hosted just-in-time runner that GitHub's six-hour cap
for hosted jobs does not bound.
Examples
--------
>>> selected_runner(ESTATE_EXPRESSION, "fork")
'ubuntu-latest'
>>> selected_runner(ESTATE_EXPRESSION, "push")
'ubicloud-standard-2'
>>> len(placement_faults("ubuntu-latest"))
3
>>> placement_faults(ESTATE_EXPRESSION)
[]
"""
#: The Ubicloud runner class every placed lane names.
: =
#: The hosted runner a fork's pull request falls back to.
: =
#: The context value that is true only for a pull request from a fork.
: =
#: The estate's runner expression, as a lane writes it.
: =
#: The estate shape: a condition, a quoted hosted arm and a quoted other arm.
: =
#: The kinds of run a runner expression is evaluated for. A push and a
#: dispatch have no pull request, so the fork value is null and they
#: behave as a same-repository pull request does.
: =
"""Return the label a `runs-on` value selects for a run.
Returns None when the value is not the estate's
`<fork> && '<hosted>' || '<label>'` shape. A literal label is not the
shape: a lane that never falls back cannot serve a fork, and a lane
that never leaves the hosted pool is not placed at all.
Parameters
----------
runs_on : object
The job's `runs-on` value as parsed; anything but a string has no
selection.
origin : str
The kind of run: `push` (also a dispatch), `same-repository` or
`fork`.
Returns
-------
str or None
The selected label, or None when the value is not the estate shape.
"""
=
return None
return
"""Return one entry per kind of run the expression places wrongly.
Empty when a fork falls back to hosted and every other run is on
the Ubicloud runner class `label`.
Parameters
----------
runs_on : object
The job's `runs-on` value as parsed.
label : str
The Ubicloud runner class every non-fork run must select.
Returns
-------
list[str]
One description per kind of run placed wrongly.
"""
=
=
return
"""Return every job whose `runs-on` names Ubicloud.
Each entry is the workflow path, the job, its `runs-on` value and the
`timeout-minutes` it states (None when it states none). A matrix
expression such as `${{ matrix.runner }}` is not a name, so it is
not listed: the matrix values are covered where they are written.
Parameters
----------
workflows : list[Workflow]
The parsed workflows to search.
Returns
-------
list[tuple[str, str, object, object]]
Path, job, `runs-on` value and stated ceiling, in file and job order.
"""
return