Skip to content

feat(team): run the team workflows on the runner KM_RUNNER names - #97

Merged
pasrom merged 3 commits into
mainfrom
feat/selectable-runner
Nov 18, 2026
Merged

pasrom merged 3 commits into
mainfrom
feat/selectable-runner

Conversation

@pasrom

@pasrom pasrom commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

What

Every job of the team workflows (ci, staleness, main-guard, approve-fork-ci, review-request-guide, automerge, bump-mounted-pins) now runs on

runs-on: ${{ vars.KM_RUNNER || 'ubuntu-latest' }}

bump-mounted-pins keeps its own variable first: ${{ vars.MOUNTED_PINS_RUNNER || vars.KM_RUNNER || 'ubuntu-latest' }}. Unset, nothing changes.

What each workflow needs on a plain Ubuntu 24.04 VM

Workflow / job Needs Done here
ci validate, staleness demote git, the km action (setup-python, PyPI), upload-artifact nothing: setup-python supports self-hosted Ubuntu (relocatable builds, writable tool cache); documented
main-guard check gh, jq tools step
approve-fork-ci approve gh, jq tools step
review-request-guide guide gh, jq, mikefarah's yq v4 tools step; Ubuntu's yq package is kislyuk's, so yq is checked by --version, not by presence
automerge resolve / decide / act gh + jq / gh (km automerge calls gh) / gh + jq tools step; act never downloads where it mints the App token (see below)
bump-mounted-pins (3 container jobs) docker for the runner's user documented; without docker set MOUNTED_PINS_RUNNER=ubuntu-latest to keep it on GitHub's runners

The tools step is the same in every job (a test checks it): it runs only while KM_RUNNER is set, skips any tool already on the PATH, and otherwise downloads gh 2.103.3, jq 1.8.2 or yq v4.54.1 for linux amd64/arm64 into $RUNNER_TEMP, verified by sha256 (taken from the downloads and checked against each project's published checksum list), with no sudo. Any other OS or architecture gets an error naming the tool to install. Checked in ubuntu:24.04 containers on both architectures: install, the second run skips, a wrong sha256 fails the step.

Timeouts

Every job now has timeout-minutes (15 at most: ci, staleness and the bump-mounted-pins jobs 15, main-guard 10; the others already had one), so a stuck job does not hold a self-hosted runner for 6 hours. A test enforces it for every job.

Security

  • pull_request_target jobs still never check out the pull request; a new test asserts that their only checkout is pasrom/km. Environments are unchanged.
  • automerge act: when it merges with the App (KM_AUTOMERGE_APP), the tools step is skipped and a check fails the run if gh or jq are missing, so the App token is never handed to a downloaded binary (the repo's rule for jobs holding an App token).
  • Where the step fetches gh, that gh runs in jobs holding a write GITHUB_TOKEN (act without the App, main-guard's issue), equivalent to a pinned action; stated in the README.
  • If GitHub passes the brain's variables to a fork's pull_request run, a fork's ci runs on your hardware, and approve-fork-ci keeps starting it without a person when no control file changed (ci runs km on the docs, nothing from the checkout); otherwise fork ci stays on GitHub's runner. Decision: auto-approval stays with KM_RUNNER set, for ephemeral, isolated runners; the README says not to set KM_RUNNER on persistent or non-isolated runners while approve-fork-ci auto-approves. No new variable.
  • Known limit (README): whether vars reaches fork and Dependabot pull_request runs is not verified yet; to be checked on the first real fork PR or sandbox run.

Upgrade and SHIPPED

  • SHIPPED keeps every old hash and adds the new ones for approve-fork-ci, automerge, main-guard, review-request-guide and bump-mounted-pins, so km upgrade moves unchanged copies forward.
  • ci.yml and staleness.yml belong to the brain and are not rewritten. KM_CI gains the hashes of the new ci (with and without the sign-off step), so a brain that changes runs-on by hand to exactly the template's line (with or without the template's timeout-minutes: 15) still counts as km's ci; the earlier ubuntu-latest copies stay recognised. runs-on is deliberately not masked in ci_hash.

km doctor

Beside km's own ci.yml (one that uses pasrom/km@), when KM_RUNNER is set and readable (the repository's, else the organisation's; a repository variable gh may not read is not replaced by the organisation's): a note naming the runner, worded conditionally for fork runs, or a note naming ci.yml/staleness.yml when their runs-on line does not read it. Silent when unset or unreadable, never a failure.

Tests

  • New: every job of every team template uses the expression; each job that runs gh/jq/yq fetches them through the one identical, gated step; no tools download in a job that mints an App token; KM_CI covers ci.yml on ubuntu-latest and on KM_RUNNER, with and without the sign-off step; every job has timeout-minutes; doctor KM_RUNNER cases (repo, org, repo variable unreadable, unset, org unreadable, no ci, staleness or ci ignoring it, a ci that is not km's).
  • Updated: tests that pulled a job's script by position now pick the step that is not the tools step; mounted_pins_smoke expects the new expression.
  • Mutation-checked: a job reverted to ubuntu-latest, yq dropped from TOOLS, one tools step diverging, the MOUNTED_PINS_RUNNER chain shortened, the tools step removed from a job, the App guard removed from act, the gate removed, new or hand-edited KM_CI hashes removed, a job timeout removed, doctor never noting, doctor skipping the mixed state, doctor falling through on a 403, doctor ignoring whose ci.yml it is: each fails its test.
  • All smoke suites pass locally.
  • Plugin eval (one sentence added to skills/km/reference/setup.md, setup/doctor row): doctor case 1.00 over 3 runs.

Verification

Verified by tests only: no self-hosted runner is available to this repository.

Left out on purpose

  • One composite action instead of six copies of the tools step: the shipped workflows main-guard, approve-fork-ci and review-request-guide pin no km commit, and automerge's resolve and act run no km code by design; a test keeps the copies identical instead.
  • An upgrade rewrite of runs-on in ci.yml/staleness.yml: they are the brain's files; the README gives the exact line.

…ER names

Every job of the team workflows runs on ${{ vars.KM_RUNNER || 'ubuntu-latest' }};
bump-mounted-pins reads MOUNTED_PINS_RUNNER first. A job that runs gh, jq or
yq first fetches the ones a self-hosted runner lacks, pinned by version and
sha256, into the job's temp folder, the same step in every workflow. SHIPPED
and KM_CI list the new versions beside the old ones.
@pasrom
pasrom force-pushed the feat/selectable-runner branch from 2e45a7b to ace1b03 Compare November 18, 2026 08:00
@pasrom
pasrom merged commit e1872f0 into main Nov 18, 2026
4 checks passed
@pasrom
pasrom deleted the feat/selectable-runner branch November 18, 2026 08:29
@pasrom pasrom mentioned this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant