Commit 7ce98d5
authored
Add automation to reconcile release runner groups (#8332)
On-demand (and go-live-triggered) job that keeps the prod release runner
groups (name matching `-prod-.*-release-runners`, e.g.
`lf-prod-aws-ue1-release-runners`; staging clusters excluded) in sync,
so we stop hand-editing their allowed-workflows and repo-access lists at
each release milestone.
`tools/scripts/release_manage_runner_groups.py` computes the desired
state from pytorch/pytorch:
- **Refs:** `main`, `nightly`, and the release branches around the
release candidate version. The `release/X.Y` anchor is read from
`generate_binary_build_matrix.py` (`CURRENT_CANDIDATE_VERSION`, the
version used for release builds, advanced deliberately at go-live)
rather than inferred from a branch-name scan; the preceding protected
release branch is included too.
- **Workflows (discovered by runner label, not hardcoded):** an entry
workflow references a release runner label (the `rel-` marker, e.g.
`rel-l-x86iavx512-44-340`); from there it follows `uses:` only into
reusables invoked on a release label, so the build reusable
(`_binary-build-linux`) is included while non-build/non-linux workflows
are excluded. Content is fetched in a single GraphQL request (avoids
raw.githubusercontent.com 429s). The full desired allow-list is logged.
- Allowed-workflows are full-synced (stale branch pins pruned); repo
access is add-only (`pytorch/pytorch`).
**Triggers:** `workflow_dispatch`, and a `push` to `main` touching
`generate_binary_build_matrix.py` (the go-live bump). No cron. The token
is gated behind the `runner-group` environment (main only); PRs/dispatch
default to dry-run, apply runs only on main via the push bump or
`apply=true`.
**Before applying:** create the `runner-group` environment (protected to
main) with secret `RUNNER_GROUP_TOKEN`.
## Validation
- Dry-run (this PR):
https://github.com/pytorch/test-infra/actions/runs/29858710718/job/88729548933
— 7 workflows x 4 refs = 28 references.
- Apply (temporary env/apply override, since removed):
https://github.com/pytorch/test-infra/actions/runs/29858037095/job/88727234617
— reconciled the 5 prod groups to 28 references each.
Test plan: `python3 -m unittest -v
tools.tests.test_release_manage_runner_groups` (Ran 12 tests OK).
_Authored with an AI assistant (Claude)._1 parent b48159c commit 7ce98d5
5 files changed
Lines changed: 686 additions & 1 deletion
File tree
- .github/workflows
- tools
- scripts
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
0 commit comments