Commit 35a4570
authored
[CRCR] Implement CRCR upstream check run management for L3/L4 jobs (#8119)
# Summary
- The current implementation focuses on L3/L4 levels defined in the RFC:
pytorch/rfcs#90
- For detailed design for L3/L4, please refer to
pytorch/rfcs#93
# Architecture
- `webhook` function:
- [x] Create PR label handling function for L3 repo (refer to the 3
scenario cases mentioned in pytorch/rfcs#93)
- **Scenario 1**: Label arrives before the downstream workflow job is
triggered. So we cached this information in Redis using
`mark_check_run_wanted` and let the `callback` lambda create this check
run.
- **Scenario 2**: Label arrives during the downstream workflow job is
running. The `callback` lambda will cache workflow information
beforehand so it can immediately create the `in_progress` check run.
- **Scenario 3**: Label arrives after the downstream workflow job is
done. If the cached workflow information is still alive in Redis (3 days
by default, could be set by `CRCR_STATUS_TTL`), it will create a
`completed` check run immediately. Otherwise, it will not create a check
run.
- [x] Dispatch function will check for L3 label or L4, and store this
information in Redis for the `callback` to check whether a check run is
needed.
- [x] Create check run and check suite handling functions for the
downstream workflow jobs re-run mechanism within the check run.
- `callback` function:
- [x] Handle upstream check-run creation/update for L3/L4
- **Scenario 1 & L4**: Check in Redis by calling `is_check_run_wanted`
to see if this PR needs a check run. If so, immediately create one.
- **All Scenarios**: Store workflow information in Redis for check run
creation in the `webhook`.
- [x] Set "in_progress" zombie check-runs to "time_out" through a
sweeper periodically
# Changes
```md
.github/actions/cross-repo-ci-relay
└── action.yml # Add a step to capture job-name for re-run
aws/lambda/cross_repo_ci_relay/
├── tests/ # Add more unit tests
├── allowlist.py # Update utils function for L3
├── redis_helper.py # Set more keys for L3
├── gh_helper.py # Update utils function for L3
├── misc.py # Update utils function for L3
├── event_handler.py # Create PR label/check run/check suites handling function
├── cleanup_handler.py # Handle zombie check-run
└── callback_handler.py # Handle upstream check-run creation
```
# Verification
We performed the following scenario verification on our AWS Lambda
instance:
- L3:
- [x] L3 labels named `ciflow/crcr/{device}` are added immediately after
the PR is created, and show up in the corresponding check-run on the PR
with the name `crcr/{repo}/{workflow_name}/{job_name}`.
- [x] After clicking into the check-run, the corresponding information
is correct.
- [x] L3 labels are added while the workflow job is running, which
should show up the `in_progress` check-run.
- [x] L3 labels are added after the workflow job is done, which should
show up the `completed` check-run.
- [x] Check run is updated when the PR with L3 labels is reopened or
synchronized.
- L4:
- [x] Check run should be created after the PR is opened.
- [x] Check run is updated when the PR is reopened or synchronized.
- Re-run
- [x] Clicking the `Re-run` button in each failed check run will trigger
the corresponding downstream workflow failed jobs to re-run and update
the check run status to `in_progress`.
- [x] Clicking the `Re-run all jobs` or `Re-run all failed jobs` button
will trigger the corresponding downstream workflow jobs in the check
suite and update the corresponding check run status to `in_progress`.
# Unit Tests
- [x] Unit Tests (Mock)
# TODO
- Modify PyTorchBot for L3 non-blocking merge:
pytorch/pytorch#185612
- Add a new feature in PyTorchBot that automatically mentions related
on-call maintainers in L3/L4 repos when check-run fails:
#8183
cc @albanD @fffrog @KarhouTam @atalman @huydhn @zxiiro @subinz1
@jewelkm891 parent 2c48d59 commit 35a4570
16 files changed
Lines changed: 1613 additions & 48 deletions
File tree
- .github/actions/cross-repo-ci-relay-callback
- aws/lambda/cross_repo_ci_relay
- callback
- tests
- utils
- webhook
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
50 | 61 | | |
51 | 62 | | |
52 | 63 | | |
| |||
73 | 84 | | |
74 | 85 | | |
75 | 86 | | |
76 | | - | |
| 87 | + | |
77 | 88 | | |
78 | 89 | | |
79 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
34 | 53 | | |
35 | 54 | | |
36 | 55 | | |
| |||
44 | 63 | | |
45 | 64 | | |
46 | 65 | | |
47 | | - | |
48 | | - | |
| 66 | + | |
| 67 | + | |
49 | 68 | | |
50 | | - | |
| 69 | + | |
51 | 70 | | |
52 | | - | |
| 71 | + | |
53 | 72 | | |
54 | 73 | | |
55 | 74 | | |
| |||
87 | 106 | | |
88 | 107 | | |
89 | 108 | | |
90 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
91 | 113 | | |
92 | 114 | | |
93 | 115 | | |
| |||
133 | 155 | | |
134 | 156 | | |
135 | 157 | | |
| 158 | + | |
| 159 | + | |
136 | 160 | | |
137 | 161 | | |
138 | 162 | | |
| |||
175 | 199 | | |
176 | 200 | | |
177 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
178 | 237 | | |
179 | 238 | | |
180 | 239 | | |
| |||
Lines changed: 115 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
| |||
168 | 174 | | |
169 | 175 | | |
170 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
171 | 237 | | |
172 | 238 | | |
173 | 239 | | |
| |||
188 | 254 | | |
189 | 255 | | |
190 | 256 | | |
191 | | - | |
| 257 | + | |
192 | 258 | | |
193 | 259 | | |
194 | 260 | | |
| |||
237 | 303 | | |
238 | 304 | | |
239 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
240 | 354 | | |
241 | 355 | | |
242 | 356 | | |
| |||
0 commit comments