Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): pin ubuntu-latest runners to ubuntu-24.04 and lint for it (#102901)

Georges-Antoine Assie98f4b541885
diff --git a/.agents/skills/authoring-ci-workflows/SKILL.md b/.agents/skills/authoring-ci-workflows/SKILL.md
index d0d4471cd417..aa90f03ccc00 100644
--- a/.agents/skills/authoring-ci-workflows/SKILL.md
+++ b/.agents/skills/authoring-ci-workflows/SKILL.md
@@ -28,7 +28,7 @@ The linters own the mechanical rules (below); this skill is the **judgment calls
## What the linters already enforce
Run `bin/hogli lint:workflows` and `actionlint` before pushing — they gate CI, and they (not this list) are the source of truth for what's enforced.
-Today that's: `timeout-minutes` on every job, the canonical PR concurrency block, a repo-wide budget for unscoped PR event dispatches, `dorny/paths-filter` negation safety, justification for full-depth checkouts, cache-write gating, semgrep service coverage, MCP path-filter coverage of the trees the MCP build compiles, required-check gate hygiene, secrets a reusable workflow reads being declared and passed by its callers, and generic GHA correctness (bad `secrets.*` / `needs:` refs, deprecated `::set-output`, unknown runner labels).
+Today that's: `timeout-minutes` on every job, the canonical PR concurrency block, a repo-wide budget for unscoped PR event dispatches, `dorny/paths-filter` negation safety, justification for full-depth checkouts, cache-write gating, semgrep service coverage, MCP path-filter coverage of the trees the MCP build compiles, required-check gate hygiene, secrets a reusable workflow reads being declared and passed by its callers, runner labels that name an OS version rather than a floating `-latest` alias, and generic GHA correctness (bad `secrets.*` / `needs:` refs, deprecated `::set-output`, unknown runner labels).
Third-party action digests are bumped by Renovate.
## Check what a condition does before you push it
@@ -367,6 +367,10 @@ The only sanctioned exception is a job whose purpose is validating the migration
## Runners
`depot-ubuntu-<version>[-<vCPU>]` for build/compute-heavy jobs (the `-4`/`-8` suffix bumps CPU from the 2-vCPU default); GitHub-hosted for light jobs.
+**Name the OS version, never `ubuntu-latest`.**
+GitHub moves the `-latest` aliases to a new image on its own schedule (24.04 became `latest` in 2025, 26.04 follows), which changes the toolchain and system packages under every job at once with nothing in this repo to bisect.
+`WF011` rejects `ubuntu-latest`, `macos-latest`, `windows-latest` and the `depot-*-latest` mirrors in `runs-on` and in `strategy.matrix`, so use `ubuntu-24.04` (or `depot-ubuntu-24.04`) and land an image bump as its own PR.
+A runner matrix that an expression builds (`fromJSON(needs.plan.outputs.val)`) is opaque to the linter, so it fails closed: pin the labels where they are generated (`dist-workspace.toml` for the release workflows) and put `# hogli-lint: allow-generated-runner-matrix -- <where they are pinned>` above the job key.
New Depot labels must be added to the allow-list in `.github/actionlint.yaml` or actionlint fails.
Details: `/depot-github-runners`.
@@ -480,7 +484,7 @@ Roll out a new blocking lint the same way: ship `continue-on-error`, clear the i
- [ ] Canonical `concurrency:` block (per-SHA push arm if it publishes on push).
- [ ] `timeout-minutes` on every job (except reusable-caller jobs).
- [ ] Checkout names only the paths the job reads (`sparse-checkout` + cone mode off), or is shallow; bounded `1000 + blob:none` only for base diffing.
-- [ ] Third-party actions SHA-pinned; Node from `.nvmrc`; `setup-uv` version pinned.
+- [ ] Third-party actions SHA-pinned; Node from `.nvmrc`; `setup-uv` version pinned; runner labels name an OS version (`ubuntu-24.04`, never `ubuntu-latest`).
- [ ] External fetches retry (`--retry-all-errors`), except where a repeat has a side effect.
- [ ] High-volume API calls on a dedicated App token with `|| github.token` fork fallback.
- [ ] Fork PRs handled: secret-needing steps guarded with the same-repo `if:`; no secret-injecting build runs on forks.
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index db832623721f..8e6820993de7 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -12,7 +12,7 @@
# `handed_off`, true only when GitHub Actions handed the tests to this engine. Canonical's
# `Django Tests Pass` gate then relays this workflow's gate verdict. Neither the hand-off
# job nor the relay has a counterpart here.
-# - runs-on: depot-* labels instead of ubuntu-latest
+# - runs-on: depot-* labels instead of GitHub-hosted ubuntu-24.04
# - action paths: ./.depot/actions/... instead of ./.github/actions/... (pnpm-install,
# setup-sqlx-cli, setup-python-cached, setup-uv, setup-turbo, and paths-filter mirror
# the canonical composites; any deltas are documented in each mirror's header). Every
diff --git a/.github/workflows/_rust-build-images.yml b/.github/workflows/_rust-build-images.yml
index 4c151e75dd60..4aa38f13010d 100644
--- a/.github/workflows/_rust-build-images.yml
+++ b/.github/workflows/_rust-build-images.yml
@@ -51,7 +51,7 @@ on:
jobs:
load-matrix:
name: load image matrix
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 2
permissions:
contents: read
@@ -252,7 +252,7 @@ jobs:
collect:
name: collect digests
needs: [load-matrix, build]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 2
permissions:
contents: read
diff --git a/.github/workflows/browserslist.yml b/.github/workflows/browserslist.yml
index 6769bbf9117d..23d5cf881670 100644
--- a/.github/workflows/browserslist.yml
+++ b/.github/workflows/browserslist.yml
@@ -10,7 +10,7 @@ permissions:
jobs:
update-browserslist-database:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
env:
HUSKY: 0
diff --git a/.github/workflows/cd-sandbox-base-image.yml b/.github/workflows/cd-sandbox-base-image.yml
index d2eb6bbb6981..781b850d4ffd 100644
--- a/.github/workflows/cd-sandbox-base-image.yml
+++ b/.github/workflows/cd-sandbox-base-image.yml
@@ -82,8 +82,8 @@ jobs:
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'build-tasks-sandbox-image')
)
- runs-on: ubuntu-latest
- # `Run migrations` builds the schema from scratch on ubuntu-latest with no schema cache and
+ runs-on: ubuntu-24.04
+ # `Run migrations` builds the schema from scratch on ubuntu-24.04 with no schema cache and
# takes 22-29 minutes, so a 30-minute budget left no headroom and cut the job off mid-migrate
# on two of three recent runs. `Build skills`, the step this job exists for, takes 10 seconds.
timeout-minutes: 45
@@ -425,7 +425,7 @@ jobs:
sandbox_base_image_check:
needs: [changes, build_skills, sandbox_base_build]
name: Sandbox Base Image Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
permissions: {}
diff --git a/.github/workflows/cd-tasks-golden-snapshot.yml b/.github/workflows/cd-tasks-golden-snapshot.yml
index 511935ce1e71..426ec23d79b3 100644
--- a/.github/workflows/cd-tasks-golden-snapshot.yml
+++ b/.github/workflows/cd-tasks-golden-snapshot.yml
@@ -84,7 +84,7 @@ jobs:
validate_ref:
if: github.ref == 'refs/heads/master'
name: Validate the requested ref
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
@@ -130,7 +130,7 @@ jobs:
needs: validate_ref
if: vars.HOG_TASKS_GOLDEN_ENABLED == 'true' && github.ref == 'refs/heads/master'
name: Render agent skills from source
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# `Run migrations` needs a database: 24 skill templates call
# `render_hogql_example`, which reads `Team.objects.first()`. The schema
# cache below makes migrate a top-up, but a cache miss is a 22-29 minute
diff --git a/.github/workflows/ci-actionlint.yml b/.github/workflows/ci-actionlint.yml
index 4fd414d33a57..bdf7e976a346 100644
--- a/.github/workflows/ci-actionlint.yml
+++ b/.github/workflows/ci-actionlint.yml
@@ -20,7 +20,7 @@ env:
jobs:
actionlint:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-agent-proxy.yml b/.github/workflows/ci-agent-proxy.yml
index 40cd716f60bd..8c71cfa8a756 100644
--- a/.github/workflows/ci-agent-proxy.yml
+++ b/.github/workflows/ci-agent-proxy.yml
@@ -21,7 +21,7 @@ env:
jobs:
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: Determine need to run agent-proxy checks
outputs:
@@ -53,7 +53,7 @@ jobs:
name: Agent Proxy checks
needs: changes
if: needs.changes.outputs.agent_proxy == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -82,7 +82,7 @@ jobs:
agent_proxy_ci:
needs: [changes, agent-proxy]
name: Agent Proxy CI Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# !cancelled(): a superseded run records cancelled (which branch protection
# does not treat as a pass) instead of running on to report failure. A cancelled
diff --git a/.github/workflows/ci-agent-skills.yml b/.github/workflows/ci-agent-skills.yml
index 8b52450e2202..92e56ff4be63 100644
--- a/.github/workflows/ci-agent-skills.yml
+++ b/.github/workflows/ci-agent-skills.yml
@@ -58,7 +58,7 @@ jobs:
check-skills:
name: Check agent skills
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 30
needs: changes
if: needs.changes.outputs.skills == 'true'
@@ -278,7 +278,7 @@ jobs:
current-master:
name: Check current master
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
needs: check-skills
if: github.repository_owner == 'PostHog' && github.ref == 'refs/heads/master'
@@ -305,7 +305,7 @@ jobs:
release-skills:
name: Release agent skills
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: [check-skills, current-master]
if: github.repository_owner == 'PostHog' && github.ref == 'refs/heads/master' && needs.current-master.outputs.is-current == 'true'
diff --git a/.github/workflows/ci-ai.yml b/.github/workflows/ci-ai.yml
index 52f36886f973..1d5a6921b0ea 100644
--- a/.github/workflows/ci-ai.yml
+++ b/.github/workflows/ci-ai.yml
@@ -11,7 +11,7 @@ jobs:
eval:
timeout-minutes: 45
name: AI evals / ${{ matrix.group }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -147,7 +147,7 @@ jobs:
eval-summary:
timeout-minutes: 5
name: AI evals / summary
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: eval
# A status function is required to summarize even when some eval groups errored.
# !cancelled() rather than always() so a superseded run does not post an eval
diff --git a/.github/workflows/ci-alerts-devex.yml b/.github/workflows/ci-alerts-devex.yml
index d066a70ff2eb..9d1f31000cfb 100644
--- a/.github/workflows/ci-alerts-devex.yml
+++ b/.github/workflows/ci-alerts-devex.yml
@@ -83,7 +83,7 @@ jobs:
github.event_name != 'workflow_run' ||
github.event.workflow_run.event == 'push' ||
github.event.workflow_run.event == 'schedule'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-backend-shadow-drift.yml b/.github/workflows/ci-backend-shadow-drift.yml
index 5ed8b3479b96..2e7e58565f22 100644
--- a/.github/workflows/ci-backend-shadow-drift.yml
+++ b/.github/workflows/ci-backend-shadow-drift.yml
@@ -32,7 +32,7 @@ concurrency:
jobs:
check:
name: Backend CI shadows remain synchronized
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# 5 min absorbs cold-runner startup + the explicit depth=100 fetch of BASE_SHA below.
# `actions/checkout` defaults to depth=1 (HEAD only); a full-history clone is unnecessary
# — we only need to diff two SHAs.
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 588304f62302..39c68c3fb217 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -470,7 +470,7 @@ jobs:
# this job breaks that lookup.
hand-off-to-depot:
name: Hand off backend tests to Depot CI
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 2
needs: [changes]
if: needs.changes.outputs.engine == 'depot'
@@ -1472,7 +1472,7 @@ jobs:
contents: read
actions: write
name: Cancel Backend CI after repo check failure
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Cancel run
env:
@@ -1497,8 +1497,8 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository
&& needs.changes.outputs.engine != 'depot'
timeout-minutes: 5
- name: Validate product.yaml owners (ubuntu-latest)
- runs-on: ubuntu-latest
+ name: Validate product.yaml owners (ubuntu-24.04)
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -1516,7 +1516,7 @@ jobs:
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
- # Plain setup-python: this PR-only job runs on ubuntu-latest, whose cache
+ # Plain setup-python: this PR-only job runs on ubuntu-24.04, whose cache
# store no master job ever saves the python tool cache to, so the
# setup-python-cached restore would miss on every run.
- name: Set up Python
@@ -2290,7 +2290,7 @@ jobs:
# Mirror the dump there so fork PRs prime instead of migrating from scratch.
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Mirror schema cache to GitHub cache
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
@@ -2552,7 +2552,7 @@ jobs:
contents: read
actions: write
name: Cancel Backend CI after OpenAPI check failure
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
steps:
- name: Cancel run
env:
@@ -3917,7 +3917,7 @@ jobs:
# Only in UPDATE mode - CHECK mode verifies snapshots match exactly
# Run even if some matrix jobs failed (to commit snapshots from passing jobs)
if: ${{ !cancelled() && needs.detect-snapshot-mode.outputs.mode == 'update' && needs.changes.outputs.backend == 'true' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog' }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
@@ -3999,7 +3999,7 @@ jobs:
repo-checks,
]
name: Django Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
permissions:
contents: read
actions: read # the failure rollup downloads each shard's JUnit artifact
@@ -4273,7 +4273,7 @@ jobs:
!cancelled() && github.event_name == 'pull_request' &&
needs.changes.result != 'skipped' &&
(needs.django.result != 'skipped' || needs.turbo-tests.result != 'skipped')
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
@@ -4369,7 +4369,7 @@ jobs:
calculate-running-time:
name: Calculate running time
needs: [changes, django_tests]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# Run on pull requests to PostHog/posthog + on PostHog/posthog outside of PRs - but never on forks or Dependabot (no secrets access)
if: >-
@@ -4417,7 +4417,7 @@ jobs:
capture-test-selection:
name: Capture test selection
needs: [turbo-discover]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# An empty mode means this run never selected, so there is no decision to report.
# DevEx project only, mirroring monitor-github-rate-limit; continue-on-error so
@@ -4442,7 +4442,7 @@ jobs:
# django and turbo-tests are here for their results only; django_tests already
# waits for both, so this adds no wall time.
needs: [django_tests, django, turbo-tests]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
continue-on-error: true
timeout-minutes: 10
# Runs on every attempt: a re-run passing what an earlier attempt failed is the same-commit
@@ -4513,7 +4513,7 @@ jobs:
backend-coverage-report:
name: Backend coverage report
needs: [changes, turbo-tests, django_tests, turbo-discover]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
continue-on-error: true # report-only, never block a PR
timeout-minutes: 10
# Pinned job-level: this job runs PR-head-controlled scripts with github.token, so its
diff --git a/.github/workflows/ci-cli.yml b/.github/workflows/ci-cli.yml
index 4ac7c6301027..20eb21a559fd 100644
--- a/.github/workflows/ci-cli.yml
+++ b/.github/workflows/ci-cli.yml
@@ -25,7 +25,7 @@ concurrency:
jobs:
tests:
name: Run tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
# Skipped on trunk-merge/** heads: merge-queue PRs are ephemeral and every
# constituent PR already ran this in full.
@@ -51,7 +51,7 @@ jobs:
clippy:
name: Clippy
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
if: ${{ !startsWith(github.head_ref, 'trunk-merge/') }}
defaults:
@@ -71,7 +71,7 @@ jobs:
format:
name: Format
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !startsWith(github.head_ref, 'trunk-merge/') }}
defaults:
@@ -91,7 +91,7 @@ jobs:
api-cli-release-bundle:
name: API CLI release bundle
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
if: ${{ !startsWith(github.head_ref, 'trunk-merge/') }}
steps:
diff --git a/.github/workflows/ci-dagster.yml b/.github/workflows/ci-dagster.yml
index 947f4683fbe6..be84de5107a2 100644
--- a/.github/workflows/ci-dagster.yml
+++ b/.github/workflows/ci-dagster.yml
@@ -74,7 +74,7 @@ jobs:
# actually import — prevents silent drift where a new import slips in
# without a matching filter entry.
validate-paths:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: Validate dagster path filter coverage
steps:
@@ -89,7 +89,7 @@ jobs:
# Job to decide if we should run dagster ci
# See .github/actions/paths-filter/README.md for filter semantics
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: Determine need to run dagster checks
# Set job outputs to values from filter step
@@ -383,7 +383,7 @@ jobs:
&& needs.changes.outputs.merge_queue != 'true'
&& needs.changes.outputs.dagster_direct == 'true'
&& !contains(github.event.pull_request.labels.*.name, 'run-ci-dagster')
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
mode: ${{ steps.classify.outputs.mode }}
@@ -752,7 +752,7 @@ jobs:
dagster_tests:
needs: [changes, dagster]
name: Dagster Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-e2e-playwright-audit.yml b/.github/workflows/ci-e2e-playwright-audit.yml
index 9f91707ad964..1d9f8c6c5d92 100644
--- a/.github/workflows/ci-e2e-playwright-audit.yml
+++ b/.github/workflows/ci-e2e-playwright-audit.yml
@@ -22,7 +22,7 @@ permissions:
jobs:
trigger_audit:
name: Trigger Playwright run with retries=0
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Dispatch main E2E workflow with PLAYWRIGHT_RETRIES=0
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index 45f97c674090..47688b5bc636 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -98,7 +98,7 @@ jobs:
token: ${{ secrets.TRUNK_API_TOKEN }}
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# 7 not 5: the debounce step below sleeps up to 60s, so widen the budget to
# keep ample headroom. A timeout here skips Playwright, which the aggregator
# would count as a pass.
@@ -389,7 +389,7 @@ jobs:
&& github.event_name == 'pull_request'
&& github.event.pull_request.draft != true
&& github.event.pull_request.head.repo.full_name == github.repository
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
mode: ${{ steps.classify.outputs.mode }}
@@ -1210,7 +1210,7 @@ jobs:
# hogli-lint: not-a-required-gate - records telemetry and emits no required check.
capture-run-time:
name: Capture run time
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
needs: [changes, select-specs, playwright, playwright_tests]
if: # Run on pull requests to PostHog/posthog + on PostHog/posthog outside of PRs - but never on forks or Dependabot (no secrets access)
@@ -1375,7 +1375,7 @@ jobs:
playwright_tests:
needs: [changes, playwright, vr-complete]
name: Playwright tests pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index 20c278b4686c..44ac7e8cccb5 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -73,7 +73,7 @@ jobs:
# we skip each step individually, so they are still reported as success
# because many of them are required for CI checks to be green
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# A draft PR labeled `no-ci` skips this workflow entirely (prototypes):
# every other job needs this one, and the gates treat skipped as success.
@@ -268,7 +268,7 @@ jobs:
# PR takes the full matrix and a draft skips jest, deferring to its ready run.
select-jest-tests:
name: Select jest tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
needs: changes
# Trunk's merge-queue branches open as draft PRs, but their run IS the
@@ -441,7 +441,7 @@ jobs:
# Not on the hourly cron: that lane exists for jest only, and formatting
# already ran on the push that landed each commit.
if: needs.changes.outputs.frontend == 'true' && github.event_name != 'schedule'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -525,7 +525,7 @@ jobs:
# Not on the hourly cron: the vs-base comparison build is pull_request-only,
# so a cron run measures an absolute size with nothing to compare it against.
if: needs.changes.outputs.frontend_code == 'true' && github.event_name != 'schedule'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -769,7 +769,7 @@ jobs:
# already ran on the push that landed each commit.
if: needs.changes.outputs.frontend_code == 'true' && github.event_name != 'schedule'
# tsgo peaks ~12 GB type-checking the whole frontend, which OOM-kills it on a 16 GB
- # runner (ubuntu-latest and depot-ubuntu-24.04-4 alike). Peak tracks the type graph,
+ # runner (ubuntu-24.04 and depot-ubuntu-24.04-4 alike). Peak tracks the type graph,
# not parallelism or lib checking: skipLibCheck is already on, GOMAXPROCS and
# declaration:false change nothing, and dropping all of products/ from include removes
# only 891 of 13703 files because imports pull them back in. Both runners below give
@@ -856,7 +856,7 @@ jobs:
run: node bin/validate-setup-tasks.mjs
jest:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# PRs run two selective shards over the tests reachable from the changed
# files. The merge queue runs the full four-shard fanout.
timeout-minutes: 20
@@ -948,7 +948,7 @@ jobs:
--shard=$SHARD_INDEX/$SHARD_COUNT \
--findRelatedTests $CHANGED_FILES
else
- # 100% = one worker per available core. Public-repo ubuntu-latest
+ # 100% = one worker per available core. Public-repo ubuntu-24.04
# runners have 4 vCPUs; a hardcoded 2 left half the machine idle.
bin/turbo run test --filter=@posthog/frontend -- --maxWorkers=100%
fi
@@ -991,7 +991,7 @@ jobs:
run: exit 1
jest-replay-shared:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: changes
if: needs.changes.outputs.replay_shared == 'true'
@@ -1062,7 +1062,7 @@ jobs:
report-test-signals:
name: Report Jest test signals
needs: [jest]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
continue-on-error: true
timeout-minutes: 10
permissions:
@@ -1135,7 +1135,7 @@ jobs:
frontend_tests,
changes,
]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: # Run on pull requests to PostHog/posthog + on PostHog/posthog outside of PRs - but never on forks or Dependabot (no secrets access)
${{ !cancelled() && github.actor != 'dependabot[bot]' &&
@@ -1192,7 +1192,7 @@ jobs:
capture-jest-selection:
name: Capture jest selection
needs: [select-jest-tests, jest]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# Either the selector reached a decision, or jest ran without it (the full-run
# baseline). Neither holds on a frontend-untouched PR, and there is nothing to
@@ -1234,7 +1234,7 @@ jobs:
frontend_tests:
needs: [changes, jest, jest-replay-shared, frontend-format, frontend-bundle-size, frontend-typescript-checks]
name: Frontend Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-geoip-canary.yml b/.github/workflows/ci-geoip-canary.yml
index abb618658578..2d4ddea4e162 100644
--- a/.github/workflows/ci-geoip-canary.yml
+++ b/.github/workflows/ci-geoip-canary.yml
@@ -29,7 +29,7 @@ permissions:
jobs:
canary:
name: Live GeoLite2 database sanity
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-hobby.yml b/.github/workflows/ci-hobby.yml
index 1569c2aa60ce..54c97d9f8158 100644
--- a/.github/workflows/ci-hobby.yml
+++ b/.github/workflows/ci-hobby.yml
@@ -43,7 +43,7 @@ jobs:
# Determine if we should run based on changed files or preview label
# See .github/actions/paths-filter/README.md for filter semantics
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# trunk-merge/** heads are skipped: merge-queue PRs are ephemeral and every
# constituent PR already ran this in full.
diff --git a/.github/workflows/ci-integration-service.yml b/.github/workflows/ci-integration-service.yml
index 41550c5d0e3e..0f80e43efc0c 100644
--- a/.github/workflows/ci-integration-service.yml
+++ b/.github/workflows/ci-integration-service.yml
@@ -33,7 +33,7 @@ env:
jobs:
integration-service:
name: Integration Service checks
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-lint-workflows.yml b/.github/workflows/ci-lint-workflows.yml
index 3bb6d74503d6..612d8322e998 100644
--- a/.github/workflows/ci-lint-workflows.yml
+++ b/.github/workflows/ci-lint-workflows.yml
@@ -20,7 +20,7 @@ permissions:
jobs:
lint-workflows:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -41,7 +41,7 @@ jobs:
workflow-run-plans:
name: Workflow run plans
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-llm-gateway.yml b/.github/workflows/ci-llm-gateway.yml
index c2b5bb69a415..7588efa51e55 100644
--- a/.github/workflows/ci-llm-gateway.yml
+++ b/.github/workflows/ci-llm-gateway.yml
@@ -24,7 +24,7 @@ permissions:
jobs:
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: Determine need to run LLM Services checks
outputs:
@@ -56,7 +56,7 @@ jobs:
name: LLM Gateway Tests
needs: changes
if: needs.changes.outputs.llm_gateway == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
defaults:
run:
@@ -103,7 +103,7 @@ jobs:
llm_services_tests:
needs: [changes, llm-gateway]
name: LLM Services Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# !cancelled(): a superseded run records cancelled (which branch protection
# does not treat as a pass) instead of running on to report failure. A cancelled
diff --git a/.github/workflows/ci-master-run-traces.yml b/.github/workflows/ci-master-run-traces.yml
index c2805ec095ce..419cf4f693f4 100644
--- a/.github/workflows/ci-master-run-traces.yml
+++ b/.github/workflows/ci-master-run-traces.yml
@@ -46,7 +46,7 @@ jobs:
name: Emit master run traces
# hogli-lint: not-a-required-gate — report-only telemetry, gates nothing.
if: github.repository == 'PostHog/posthog'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
# A cron workflow always runs the default-branch copy of this file, so the
diff --git a/.github/workflows/ci-mcp-ui-apps.yml b/.github/workflows/ci-mcp-ui-apps.yml
index 389492c26ece..563c9421e786 100644
--- a/.github/workflows/ci-mcp-ui-apps.yml
+++ b/.github/workflows/ci-mcp-ui-apps.yml
@@ -60,7 +60,7 @@ jobs:
build-and-report:
name: Build and validate UI Apps
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: changes
if: needs.changes.outputs.ui-apps == 'true'
@@ -144,7 +144,7 @@ jobs:
ci_mcp_ui_apps:
needs: [changes, build-and-report]
name: MCP UI Apps CI
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.yml
index 36726b12eaa7..fcfb0e0442c6 100644
--- a/.github/workflows/ci-mcp.yml
+++ b/.github/workflows/ci-mcp.yml
@@ -177,7 +177,7 @@ jobs:
- 'frontend/src/mocks/fixtures/**'
build:
name: Build Package
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: changes
# Not on master push — master coverage comes from the hourly run (see `schedule`).
@@ -256,7 +256,7 @@ jobs:
unit-tests:
name: Unit Tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: changes
# Not on master push — master coverage comes from the hourly run (see `schedule`).
@@ -785,7 +785,7 @@ jobs:
handle-snapshots:
name: Commit snapshot changes
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
needs: [changes, unit-tests]
# A status function is required to commit regenerated snapshots even when unit-tests
@@ -856,7 +856,7 @@ jobs:
mcp_tests:
needs: [changes, build, unit-tests, integration-tests, handle-snapshots]
name: MCP Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-migrations-service-separation-check.yml b/.github/workflows/ci-migrations-service-separation-check.yml
index 7fd77a15559e..5eebabe0ee05 100644
--- a/.github/workflows/ci-migrations-service-separation-check.yml
+++ b/.github/workflows/ci-migrations-service-separation-check.yml
@@ -15,7 +15,7 @@ permissions:
jobs:
check-migration-service-separation:
name: Check migrations and service changes are not in same PR
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-nodejs.yml b/.github/workflows/ci-nodejs.yml
index 04fdd6a4457f..4b347d951b2e 100644
--- a/.github/workflows/ci-nodejs.yml
+++ b/.github/workflows/ci-nodejs.yml
@@ -56,7 +56,7 @@ jobs:
# Job to decide if we should run nodejs services ci
# See .github/actions/paths-filter/README.md for filter semantics
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
name: Determine need to run Node.js checks
permissions:
@@ -954,7 +954,7 @@ jobs:
report-test-speed:
name: Node.js test-speed report
needs: [tests]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: true
permissions:
@@ -1019,7 +1019,7 @@ jobs:
capture-nodejs-selection:
name: Capture Node.js jest selection
needs: [changes, tests]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# Nothing to report on a PR that never ran the suite. Forks and Dependabot never
# have the secret.
@@ -1055,7 +1055,7 @@ jobs:
# report-test-speed is deliberately not in needs: it is visible but non-gating.
needs: [changes, tests, rust_ingestion_e2e, build, lint]
name: Node.js Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-oauth-proxy.yml b/.github/workflows/ci-oauth-proxy.yml
index ef1425787db2..b1fbc54ec3eb 100644
--- a/.github/workflows/ci-oauth-proxy.yml
+++ b/.github/workflows/ci-oauth-proxy.yml
@@ -44,7 +44,7 @@ jobs:
build-and-test:
name: Build & Test
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
needs: changes
if: needs.changes.outputs.oauth-proxy == 'true'
@@ -66,7 +66,7 @@ jobs:
oauth_proxy_tests:
needs: [changes, build-and-test]
name: OAuth Proxy Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-openapi-codegen.yml b/.github/workflows/ci-openapi-codegen.yml
index 8709deae7372..3fbe6f88d3aa 100644
--- a/.github/workflows/ci-openapi-codegen.yml
+++ b/.github/workflows/ci-openapi-codegen.yml
@@ -19,7 +19,7 @@ permissions:
jobs:
test:
name: OpenAPI codegen tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/ci-owners-live-lint.yml b/.github/workflows/ci-owners-live-lint.yml
index 52a0c132ad07..a20effd6677f 100644
--- a/.github/workflows/ci-owners-live-lint.yml
+++ b/.github/workflows/ci-owners-live-lint.yml
@@ -27,7 +27,7 @@ concurrency:
jobs:
owners-live-lint:
name: Validate every ownership identity against GitHub
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
# Plain checkout: the lint reads every owners.yaml and product.yaml in the tree.
diff --git a/.github/workflows/ci-playwright-container.yml b/.github/workflows/ci-playwright-container.yml
index 3f396aa88966..91a97be3fa40 100644
--- a/.github/workflows/ci-playwright-container.yml
+++ b/.github/workflows/ci-playwright-container.yml
@@ -17,7 +17,7 @@ on:
jobs:
mirror:
name: Mirror mcr.microsoft.com/playwright to GHCR
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
packages: write
diff --git a/.github/workflows/ci-proto.yml b/.github/workflows/ci-proto.yml
index 1224905eae18..fdab7362c6ee 100644
--- a/.github/workflows/ci-proto.yml
+++ b/.github/workflows/ci-proto.yml
@@ -180,7 +180,7 @@ jobs:
proto_checks:
needs: [changes, lint, breaking, python-codegen, node-codegen]
name: Proto Checks Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml
index 7528d3c5e18c..89dec512b560 100644
--- a/.github/workflows/ci-python.yml
+++ b/.github/workflows/ci-python.yml
@@ -50,7 +50,7 @@ jobs:
# Job to decide if we should run python ci
# See .github/actions/paths-filter/README.md for filter semantics
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: Determine need to run python checks
# Set job outputs to values from filter step
@@ -445,7 +445,7 @@ jobs:
python_tests:
needs: [changes, code-quality]
name: Python code quality checks
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-replay-vision-evals.yml b/.github/workflows/ci-replay-vision-evals.yml
index 218d5e8b3f7f..0690c632ba43 100644
--- a/.github/workflows/ci-replay-vision-evals.yml
+++ b/.github/workflows/ci-replay-vision-evals.yml
@@ -34,7 +34,7 @@ jobs:
golden-eval:
name: Golden-dataset scanner eval
timeout-minutes: 60
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml
index 1af4d97422b3..e9da72bc5369 100644
--- a/.github/workflows/ci-rust.yml
+++ b/.github/workflows/ci-rust.yml
@@ -962,7 +962,7 @@ jobs:
rust_tests:
needs: [changes, affected, build, test, linting]
name: Rust Tests Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
permissions: {}
diff --git a/.github/workflows/ci-scripts.yml b/.github/workflows/ci-scripts.yml
index 85a4eebc37a7..da7fbf594e42 100644
--- a/.github/workflows/ci-scripts.yml
+++ b/.github/workflows/ci-scripts.yml
@@ -35,7 +35,7 @@ permissions:
jobs:
script-tests:
name: .github/scripts unit tests
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
# The tests take seconds, so a full checkout of the monorepo dominated
diff --git a/.github/workflows/ci-security.yaml b/.github/workflows/ci-security.yaml
index fc490011e07c..4cabaeca62cc 100644
--- a/.github/workflows/ci-security.yaml
+++ b/.github/workflows/ci-security.yaml
@@ -18,7 +18,7 @@ jobs:
# See .github/actions/paths-filter/README.md for filter semantics
# Pushes and PRs above GitHub's 3000-file API limit run every scan.
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
name: Determine need to run Semgrep checks
@@ -142,7 +142,7 @@ jobs:
semgrep-python:
needs: changes
if: needs.changes.outputs.python == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 30
env:
@@ -190,7 +190,7 @@ jobs:
semgrep-go:
needs: changes
if: needs.changes.outputs.go == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
env:
@@ -226,7 +226,7 @@ jobs:
semgrep-rust:
needs: changes
if: needs.changes.outputs.rust == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
env:
@@ -264,7 +264,7 @@ jobs:
semgrep-js:
needs: changes
if: needs.changes.outputs.js == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
env:
@@ -305,7 +305,7 @@ jobs:
semgrep-products-frontend:
needs: changes
if: needs.changes.outputs.products-frontend == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
env:
@@ -340,7 +340,7 @@ jobs:
semgrep-general:
needs: changes
if: needs.changes.outputs.general == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# The scan itself sits around 12 minutes, so 20 left too little headroom
# for a slow runner and the job was tripping the timeout.
timeout-minutes: 30
@@ -398,7 +398,7 @@ jobs:
semgrep-devex:
needs: changes
if: needs.changes.outputs.devex == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
env:
@@ -478,7 +478,7 @@ jobs:
semgrep-test-rules:
needs: changes
if: needs.changes.outputs.test-rules == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
env:
@@ -513,7 +513,7 @@ jobs:
semgrep-desktop:
needs: changes
if: needs.changes.outputs.desktop == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 20
env:
@@ -565,7 +565,7 @@ jobs:
- semgrep-test-rules
- semgrep-desktop
name: Semgrep Checks Pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index fe74af1a0c92..1eef829d243f 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -58,7 +58,7 @@ jobs:
# Job to decide if we should run storybook ci
# See .github/actions/paths-filter/README.md for filter semantics
changes:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# A draft PR labeled `no-ci` skips this workflow entirely (prototypes):
# every other job needs this one, and the gates treat skipped as success.
@@ -340,7 +340,7 @@ jobs:
vr-setup:
name: Create Visual Review run
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# The VR CLI build dominates this job whenever the cache misses, and it then
# downloads the whole dependency tree. vr-complete allows the same budget for the
# same build.
@@ -481,7 +481,7 @@ jobs:
visual-regression:
name: Visual regression tests - ${{ matrix.browser }} (${{ matrix.shard }}/${{ matrix.shard_count }})
- runs-on: ${{ matrix.browser == 'webkit' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ runs-on: ${{ matrix.browser == 'webkit' && 'depot-ubuntu-24.04' || 'ubuntu-24.04' }}
needs: [changes, build-storybook, vr-setup, select-stories]
# A status function is required because select-stories is skipped on forced-full
# PRs and master pushes. !cancelled() rather than always() so a superseded run's
@@ -772,7 +772,7 @@ jobs:
# Catches flaky snapshots before they land on master.
flake-verification:
name: Storybook flake verification
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
needs: [changes, build-storybook]
# Skipped on trunk-merge/**: the job diffs against base.sha to find changed stories,
# which on a queue branch is the same set the PR's own run already re-ran three times.
@@ -866,7 +866,7 @@ jobs:
visual_regression_tests:
needs: [changes, build-storybook, select-stories, visual-regression, vr-setup, vr-complete]
name: Visual regression tests pass
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: ${{ !cancelled() }}
steps:
@@ -915,7 +915,7 @@ jobs:
vr-complete:
name: Complete Visual Review run
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 15
needs: [changes, visual-regression, vr-setup]
# Intentional always(), not !cancelled(): this job finalizes external state,
@@ -1022,7 +1022,7 @@ jobs:
calculate-running-time:
name: Calculate running time
needs: [visual-regression, visual_regression_tests, changes]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: # Run on pull requests to PostHog/posthog + on PostHog/posthog outside of PRs - but never on forks or Dependabot (no secrets access)
${{ !cancelled() && github.actor != 'dependabot[bot]' &&
@@ -1067,7 +1067,7 @@ jobs:
capture-story-selection:
name: Capture story selection
needs: [select-stories]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# select-stories skips merge-queue and forced-full runs. Fire only when it
# produced a decision. DevEx project only; continue-on-error so telemetry never reds CI.
@@ -1106,7 +1106,7 @@ jobs:
# uncertainty also falls back to the full matrix.
select-stories:
name: Story selection
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
needs: [changes, build-storybook]
if: |
diff --git a/.github/workflows/desktop-agent-release.yml b/.github/workflows/desktop-agent-release.yml
index 71b1ebb0d343..8f84e37aaac6 100644
--- a/.github/workflows/desktop-agent-release.yml
+++ b/.github/workflows/desktop-agent-release.yml
@@ -18,7 +18,7 @@ jobs:
release:
name: Publish agent to npm
# npm provenance requires a github-hosted runner; Depot registers as self-hosted
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 30
environment: npm-posthog-agent
permissions:
diff --git a/.github/workflows/desktop-sync-benjamin.yml b/.github/workflows/desktop-sync-benjamin.yml
index 5004b5e233e5..e55a4df4067d 100644
--- a/.github/workflows/desktop-sync-benjamin.yml
+++ b/.github/workflows/desktop-sync-benjamin.yml
@@ -14,7 +14,7 @@ concurrency:
jobs:
sync-benjamin:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
env:
SYNC_BRANCH: chore/sync-benjamin
diff --git a/.github/workflows/dev-sandbox-selftest.yml b/.github/workflows/dev-sandbox-selftest.yml
index d6cefdddf2b3..5b9f0ac4edbb 100644
--- a/.github/workflows/dev-sandbox-selftest.yml
+++ b/.github/workflows/dev-sandbox-selftest.yml
@@ -48,7 +48,7 @@ jobs:
shims-selftest:
name: Verify dev sandbox shims routing
# Pure string-logic test — no sandbox-exec needed, so it runs on Linux.
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
diff --git a/.github/workflows/docs-preview-trigger.yml b/.github/workflows/docs-preview-trigger.yml
index 5612b7e4a0b0..4d47b12594a4 100644
--- a/.github/workflows/docs-preview-trigger.yml
+++ b/.github/workflows/docs-preview-trigger.yml
@@ -21,7 +21,7 @@ jobs:
# all continue-on-error, so they never blocked a merge anyway.
if: ${{ !startsWith(github.head_ref, 'trunk-merge/') }}
name: Trigger posthog.com preview build
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
diff --git a/.github/workflows/eng-analytics-weekly-digest.yml b/.github/workflows/eng-analytics-weekly-digest.yml
index 601cfcf0aa67..86fd033ff679 100644
--- a/.github/workflows/eng-analytics-weekly-digest.yml
+++ b/.github/workflows/eng-analytics-weekly-digest.yml
@@ -29,7 +29,7 @@ permissions:
jobs:
digest:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Covers the script's worst case: 3 endpoint attempts x 150s abort plus 2 x 30s
# backoffs (~8.5min; it retries transient 5xxs from a contended warehouse cluster), plus setup.
timeout-minutes: 12
diff --git a/.github/workflows/inkeep-agent.yml b/.github/workflows/inkeep-agent.yml
index f9ab1b1e8a13..f8f5115f1e64 100644
--- a/.github/workflows/inkeep-agent.yml
+++ b/.github/workflows/inkeep-agent.yml
@@ -28,7 +28,7 @@ jobs:
(github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR'))
)
)
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Trigger Inkeep Agent
diff --git a/.github/workflows/monitor-github-rate-limit.yml b/.github/workflows/monitor-github-rate-limit.yml
index b6f72da159fe..97786ae7b0b2 100644
--- a/.github/workflows/monitor-github-rate-limit.yml
+++ b/.github/workflows/monitor-github-rate-limit.yml
@@ -56,7 +56,7 @@ permissions:
jobs:
poll:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 3
# Forks don't get secret access on pull_request, so the capture would
# no-op anyway — skip the run entirely to avoid noise.
diff --git a/.github/workflows/pnpm-store-cache.yml b/.github/workflows/pnpm-store-cache.yml
index 7324cdcee67d..d798339949aa 100644
--- a/.github/workflows/pnpm-store-cache.yml
+++ b/.github/workflows/pnpm-store-cache.yml
@@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- runner: [ubuntu-latest, depot-ubuntu-24.04]
+ runner: [ubuntu-24.04, depot-ubuntu-24.04]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/pr-autoresolve-conflicts.yml b/.github/workflows/pr-autoresolve-conflicts.yml
index 4671a052ee29..b645e4f1da98 100644
--- a/.github/workflows/pr-autoresolve-conflicts.yml
+++ b/.github/workflows/pr-autoresolve-conflicts.yml
@@ -54,7 +54,7 @@ env:
jobs:
detect:
name: Detect conflicting PRs
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 10 # bulk-fetches PR heads + merge-tree sweep of the open-PR pool
permissions:
contents: read
@@ -162,7 +162,7 @@ jobs:
name: Resolve #${{ matrix.pr.number }}
needs: detect
if: needs.detect.outputs.count != '0'
- runs-on: ubuntu-latest # bump to depot-ubuntu-latest-4 only if the heavy path OOMs
+ runs-on: ubuntu-24.04 # bump to depot-ubuntu-24.04-4 only if the heavy path OOMs
timeout-minutes: 35 # heavy path adds ~10-15 min of backend bring-up
# NO write token — runs PR-controlled code and the agent.
permissions:
@@ -443,7 +443,7 @@ jobs:
name: Finalize #${{ matrix.pr.number }}
needs: [detect, resolve]
if: needs.detect.outputs.count != '0'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read # writes happen via the App token, not GITHUB_TOKEN
diff --git a/.github/workflows/pr-priority-review.yml b/.github/workflows/pr-priority-review.yml
index b1475dd55149..b8b66106d207 100644
--- a/.github/workflows/pr-priority-review.yml
+++ b/.github/workflows/pr-priority-review.yml
@@ -16,7 +16,7 @@ permissions:
jobs:
# When a non-draft PR is labeled "priority-review", or a labeled PR is undrafted
notify-priority-review:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: >-
github.event.pull_request.head.repo.full_name == github.repository
@@ -89,7 +89,7 @@ jobs:
# When a priority-review PR is closed or merged, update the Slack message
cleanup-closed:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: >-
github.event.action == 'closed'
@@ -153,7 +153,7 @@ jobs:
# When a priority-review PR is approved, update the Slack message
notify-reviewed:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: >-
github.event.action == 'submitted'
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
index c40e10e3f7ff..84135065c6da 100644
--- a/.github/workflows/release-cli.yml
+++ b/.github/workflows/release-cli.yml
@@ -24,7 +24,7 @@ concurrency:
jobs:
check-changesets:
name: Check for CLI changesets
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
has-changesets: ${{ steps.check.outputs.has-changesets }}
@@ -89,7 +89,7 @@ jobs:
name: Generate CLI release preview
needs: check-changesets
if: needs.check-changesets.outputs.has-changesets == 'true'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Write CLI diff summary
@@ -176,7 +176,7 @@ jobs:
prepare-release:
name: Prepare CLI release pull request
needs: [check-changesets, cli-release-preview, notify-approval-needed]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 30
if: always() && needs.check-changesets.outputs.has-changesets == 'true' && needs.cli-release-preview.result == 'success'
environment: Release SDK
@@ -505,7 +505,7 @@ jobs:
name: Identify merged CLI release
needs: check-changesets
if: needs.check-changesets.outputs.has-changesets == 'false'
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
@@ -673,6 +673,7 @@ jobs:
path: plan-dist-manifest.json
# Build and packages all the platform-specific things
+ # hogli-lint: allow-generated-runner-matrix -- dist builds this matrix; its runner labels are pinned under [dist.github-custom-runners] in dist-workspace.toml
build-local-artifacts:
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
# Let the initial task tell us to not run (very blunt)
@@ -1076,7 +1077,7 @@ jobs:
notify-released:
name: Notify Slack - Release Published
needs: [notify-approval-needed, release, host-release, publish-npm]
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: always() && needs.host-release.result == 'success' && (needs.publish-npm.result == 'success' || needs.publish-npm.result == 'skipped') && needs.notify-approval-needed.outputs.slack_ts != ''
steps:
@@ -1102,7 +1103,7 @@ jobs:
- build-global-artifacts
- host-release
- publish-npm
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: >-
always() && (needs.plan-release.result == 'failure' || needs.build-local-artifacts.result == 'failure'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2c59e546dedd..b4ef9d63c8e8 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -91,6 +91,7 @@ jobs:
path: plan-dist-manifest.json
# Build and packages all the platform-specific things
+ # hogli-lint: allow-generated-runner-matrix -- dist builds this matrix; its runner labels are pinned under [dist.github-custom-runners] in dist-workspace.toml
build-local-artifacts:
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
# Let the initial task tell us to not run (very blunt)
diff --git a/.github/workflows/review-hog.yml b/.github/workflows/review-hog.yml
index 324e14fca18a..6aa901ccc84e 100644
--- a/.github/workflows/review-hog.yml
+++ b/.github/workflows/review-hog.yml
@@ -31,7 +31,7 @@ concurrency:
jobs:
trigger:
name: Trigger ReviewHog review
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
# Run when the `reviewhog` label lands on a non-fork PR from an allowed labeler: a human, or
# stamphog[bot] handing off a refused/escalated PR. Other bots are skipped below. Any author
@@ -66,7 +66,7 @@ jobs:
# refused PRs and is routed above); explain why and strip the label so a human can re-add it.
bot-labeler-skip:
name: Explain skipped bot label
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
issues: write
diff --git a/.github/workflows/rust-smoke-test-build.yml b/.github/workflows/rust-smoke-test-build.yml
index 4854dfce0e72..4c18a0d2f49e 100644
--- a/.github/workflows/rust-smoke-test-build.yml
+++ b/.github/workflows/rust-smoke-test-build.yml
@@ -35,7 +35,7 @@ concurrency:
jobs:
authorize:
name: authorize smoke test
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
if: |
github.event_name == 'workflow_dispatch' ||
@@ -47,7 +47,7 @@ jobs:
resolve-filter:
name: resolve image filter
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 2
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
permissions: {}
diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml
index 058009cbe909..b2b5f4a8975b 100644
--- a/.github/workflows/shellcheck.yml
+++ b/.github/workflows/shellcheck.yml
@@ -8,7 +8,7 @@ permissions:
jobs:
shell_check:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
name: shellcheck
steps:
diff --git a/.github/workflows/test-quarantine.yml b/.github/workflows/test-quarantine.yml
index 847ae7990f4c..6775f1906d29 100644
--- a/.github/workflows/test-quarantine.yml
+++ b/.github/workflows/test-quarantine.yml
@@ -22,7 +22,7 @@ permissions:
jobs:
check-quarantine:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
env:
SLACK_CHANNEL: 'C0AS64N6DJL' # #alerts-devex
diff --git a/.github/workflows/update-ai-costs.yml b/.github/workflows/update-ai-costs.yml
index dfa474eb6cb2..dbb2bce899d2 100644
--- a/.github/workflows/update-ai-costs.yml
+++ b/.github/workflows/update-ai-costs.yml
@@ -16,7 +16,7 @@ concurrency:
jobs:
update-ai-costs:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
diff --git a/.github/workflows/update-bot-ips.yml b/.github/workflows/update-bot-ips.yml
index e233dcdee141..00cbfcd35646 100644
--- a/.github/workflows/update-bot-ips.yml
+++ b/.github/workflows/update-bot-ips.yml
@@ -11,7 +11,7 @@ permissions:
jobs:
update-bot-ips:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
diff --git a/.github/workflows/weekly-flaky-report.yml b/.github/workflows/weekly-flaky-report.yml
index 5ed74b18601d..6cf6e4d43ba4 100644
--- a/.github/workflows/weekly-flaky-report.yml
+++ b/.github/workflows/weekly-flaky-report.yml
@@ -34,7 +34,7 @@ permissions:
jobs:
report:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Worst case mirrors the digest: 3 endpoint attempts x 150s abort plus 2 x 30s
# backoffs (~8.5min), plus checkout and owner resolution.
timeout-minutes: 12
diff --git a/.github/workflows/weekly-slow-tests-report.yml b/.github/workflows/weekly-slow-tests-report.yml
index ee4a2a4666c8..33330a8115e8 100644
--- a/.github/workflows/weekly-slow-tests-report.yml
+++ b/.github/workflows/weekly-slow-tests-report.yml
@@ -32,7 +32,7 @@ permissions:
jobs:
report:
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
# Worst case mirrors the flaky report: 3 HogQL attempts x 150s abort plus 2 x 30s
# backoffs (~8.5min), plus checkout, owner resolution, and the editor lookups.
timeout-minutes: 12
diff --git a/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py b/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py
index c9b33ab04722..af82c9100ff4 100644
--- a/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py
+++ b/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py
@@ -28,6 +28,7 @@ from hogli_commands.workflow_lint.checks.checkout_full_depth import CheckoutFull
from hogli_commands.workflow_lint.checks.dorny_negation import DornyNegationCheck
from hogli_commands.workflow_lint.checks.job_timeouts import JobTimeoutsCheck
from hogli_commands.workflow_lint.checks.mcp_filter_coverage import McpFilterCoverageCheck, _resolve
+from hogli_commands.workflow_lint.checks.pinned_runner_images import PinnedRunnerImagesCheck
from hogli_commands.workflow_lint.checks.pr_concurrency import PrConcurrencyCheck
from hogli_commands.workflow_lint.checks.pr_event_fanout import PrEventFanoutCheck
from hogli_commands.workflow_lint.checks.required_gates import RequiredGateCheck
@@ -209,6 +210,199 @@ class TestJobTimeoutsCheck:
assert result.issues == []
+# ---------------------------------------------------------------------------
+# PinnedRunnerImagesCheck
+# ---------------------------------------------------------------------------
+
+
+class TestPinnedRunnerImagesCheck:
+ @pytest.mark.parametrize(
+ "job_body",
+ [
+ "runs-on: ubuntu-24.04",
+ "runs-on: depot-ubuntu-24.04-4",
+ "runs-on: [self-hosted, linux]",
+ "runs-on: ${{ matrix.browser == 'webkit' && 'depot-ubuntu-24.04' || 'ubuntu-24.04' }}",
+ "runs-on: ${{ matrix.runner }}\n strategy:\n matrix:\n runner: [ubuntu-24.04, macos-15]",
+ "runs-on: ubuntu-24.04\n strategy:\n matrix:\n artifact: [cli-macos-latest, cli-windows-latest]",
+ "runs-on: ${{ matrix.runner }}\n strategy:\n matrix:\n runner: [ubuntu-24.04]\n artifact: [cli-macos-latest]",
+ ],
+ ids=["plain", "depot", "label-list", "expression", "matrix", "non-runner-matrix", "unreferenced-matrix-key"],
+ )
+ def test_passes_pinned_labels(self, tmp_path: Path, job_body: str) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ f"""
+ name: My
+ on: [pull_request]
+ jobs:
+ build:
+ {job_body.replace(chr(10), chr(10) + " ")}
+ timeout-minutes: 10
+ steps:
+ - run: echo ok
+ """,
+ )
+ assert PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues == []
+
+ @pytest.mark.parametrize(
+ "job_body,source,label",
+ [
+ ("runs-on: ubuntu-latest", "runs-on", "ubuntu-latest"),
+ ("runs-on: depot-ubuntu-latest-4", "runs-on", "depot-ubuntu-latest-4"),
+ ("runs-on: [macos-latest]", "runs-on", "macos-latest"),
+ (
+ "runs-on: ${{ matrix.browser == 'webkit' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}",
+ "runs-on",
+ "ubuntu-latest",
+ ),
+ (
+ "runs-on: ${{ matrix.runner }}\n strategy:\n matrix:\n runner: [ubuntu-latest, depot-ubuntu-24.04]",
+ "strategy.matrix.runner",
+ "ubuntu-latest",
+ ),
+ (
+ "runs-on: ${{ matrix.os }}\n strategy:\n matrix:\n include:\n - os: windows-latest",
+ "strategy.matrix.os",
+ "windows-latest",
+ ),
+ (
+ "runs-on: ${{ matrix['runner'] }}\n strategy:\n matrix:\n runner: [ubuntu-latest]",
+ "strategy.matrix.runner",
+ "ubuntu-latest",
+ ),
+ ],
+ ids=["plain", "depot-suffixed", "label-list", "expression", "matrix-list", "matrix-include", "matrix-bracket"],
+ )
+ def test_fails_floating_labels(self, tmp_path: Path, job_body: str, source: str, label: str) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ f"""
+ name: My
+ on: [pull_request]
+ jobs:
+ build:
+ {job_body.replace(chr(10), chr(10) + " ")}
+ timeout-minutes: 10
+ steps:
+ - run: echo ok
+ """,
+ )
+ [issue] = PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues
+ assert issue.job == "build"
+ assert issue.message.startswith(source)
+ assert label in issue.message
+
+ def test_generated_runner_matrix_fails_closed_without_marker(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ """
+ name: My
+ on: [pull_request]
+ jobs:
+ plan:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 10
+ outputs:
+ matrix: ${{ steps.plan.outputs.matrix }}
+ steps:
+ - id: plan
+ run: echo ok
+ build:
+ needs: [plan]
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 10
+ strategy:
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
+ steps:
+ - run: echo ok
+ """,
+ )
+ [issue] = PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues
+ assert issue.job == "build"
+ assert "allow-generated-runner-matrix" in issue.message
+
+ def test_generated_matrix_used_only_in_a_comparison_needs_no_marker(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ """
+ name: My
+ on: [pull_request]
+ jobs:
+ build:
+ runs-on: ${{ matrix.browser == 'webkit' && 'depot-ubuntu-24.04' || 'ubuntu-24.04' }}
+ timeout-minutes: 10
+ strategy:
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
+ steps:
+ - run: echo ok
+ """,
+ )
+ assert PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues == []
+
+ def test_generated_runner_matrix_passes_with_marker_and_reason(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ """
+ name: My
+ on: [pull_request]
+ jobs:
+ # hogli-lint: allow-generated-runner-matrix -- labels are pinned in dist-workspace.toml
+ build:
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 10
+ strategy:
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
+ steps:
+ - run: echo ok
+ """,
+ )
+ assert PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues == []
+
+ def test_generated_runner_matrix_marker_without_reason_still_fails(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ """
+ name: My
+ on: [pull_request]
+ jobs:
+ # hogli-lint: allow-generated-runner-matrix
+ build:
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 10
+ strategy:
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
+ steps:
+ - run: echo ok
+ """,
+ )
+ [issue] = PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues
+ assert issue.job == "build"
+
+ def test_ignores_latest_outside_runner_fields(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path,
+ "wf.yml",
+ """
+ name: My
+ on: [pull_request]
+ jobs:
+ build:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 10
+ steps:
+ - run: docker pull ghcr.io/example/ubuntu-latest
+ """,
+ )
+ assert PinnedRunnerImagesCheck().run(_read_all(tmp_path)).issues == []
+
+
# ---------------------------------------------------------------------------
# PrConcurrencyCheck
# ---------------------------------------------------------------------------
diff --git a/tools/hogli-commands/hogli_commands/workflow_lint/checks/__init__.py b/tools/hogli-commands/hogli_commands/workflow_lint/checks/__init__.py
index 640b2e7e8acc..958ca7c1dfac 100644
--- a/tools/hogli-commands/hogli_commands/workflow_lint/checks/__init__.py
+++ b/tools/hogli-commands/hogli_commands/workflow_lint/checks/__init__.py
@@ -17,6 +17,7 @@ from .checkout_full_depth import CheckoutFullDepthCheck
from .dorny_negation import DornyNegationCheck
from .job_timeouts import JobTimeoutsCheck
from .mcp_filter_coverage import McpFilterCoverageCheck
+from .pinned_runner_images import PinnedRunnerImagesCheck
from .pr_concurrency import PrConcurrencyCheck
from .pr_event_fanout import PrEventFanoutCheck
from .required_gates import RequiredGateCheck
@@ -34,6 +35,7 @@ CHECKS: list[WorkflowCheck] = [
PrEventFanoutCheck(),
McpFilterCoverageCheck(),
ReusableSecretPassthroughCheck(),
+ PinnedRunnerImagesCheck(),
]
diff --git a/tools/hogli-commands/hogli_commands/workflow_lint/checks/pinned_runner_images.py b/tools/hogli-commands/hogli_commands/workflow_lint/checks/pinned_runner_images.py
new file mode 100644
index 000000000000..25920cfb59db
--- /dev/null
+++ b/tools/hogli-commands/hogli_commands/workflow_lint/checks/pinned_runner_images.py
@@ -0,0 +1,154 @@
+"""Runner labels must name an OS version, never a floating ``-latest`` alias.
+
+GitHub moves ``ubuntu-latest`` (and the macOS/Windows aliases, and Depot's
+``depot-*-latest`` mirrors) to a new image on its own schedule. When it does,
+every job on the alias changes toolchain, system packages and default Python
+at once, with no diff in this repo to bisect. Pinning to ``ubuntu-24.04`` keeps
+the image change an explicit PR.
+
+The check reads ``runs-on`` and, for each ``matrix.<key>`` or
+``matrix['<key>']`` that ``runs-on`` references, that key's values in
+``strategy.matrix`` (including ``include`` and ``exclude`` entries). A label
+picked through ``${{ matrix.runner }}`` or an inline ``&&``/``||`` expression
+is covered as well as a plain string, while a matrix dimension that is not a
+runner never fires the check.
+
+A runner matrix built by an expression (``fromJSON(needs.plan.outputs.val)``)
+cannot be inspected here, so it fails closed: the job needs ``ALLOW_MARKER``
+with a reason naming where those labels are pinned.
+"""
+
+from __future__ import annotations
+
+import re
+from collections.abc import Iterator
+
+from ..check import CheckResult, Issue, WorkflowCheck
+from ..markers import exempt_jobs
+from ..model import Job, Workflow
+
+FLOATING_LABEL_RE = re.compile(r"(?<![\w-])((?:depot-)?(?:ubuntu|macos|windows)-latest(?:-[A-Za-z0-9.]+)*)(?![\w-])")
+MATRIX_REF_RE = re.compile(r"\bmatrix(?:\.(?P<dot>[A-Za-z_][\w-]*)|\[['\"](?P<bracket>[A-Za-z_][\w-]*)['\"]\])")
+ALLOW_MARKER = "hogli-lint: allow-generated-runner-matrix"
+
+
+def _strings(value: object) -> Iterator[str]:
+ if isinstance(value, str):
+ yield value
+ elif isinstance(value, dict):
+ for nested in value.values():
+ yield from _strings(nested)
+ elif isinstance(value, list):
+ for nested in value:
+ yield from _strings(nested)
+
+
+def _matrix_values_for(matrix: object, key: str) -> Iterator[object]:
+ if not isinstance(matrix, dict):
+ yield matrix
+ return
+ if key in matrix:
+ yield matrix[key]
+ for combination_list in ("include", "exclude"):
+ combinations = matrix.get(combination_list)
+ if not isinstance(combinations, list):
+ continue
+ for combination in combinations:
+ if isinstance(combination, dict) and key in combination:
+ yield combination[key]
+
+
+def _is_comparison_operand(text: str, match: re.Match[str]) -> bool:
+ before = text[: match.start()].rstrip()
+ after = text[match.end() :].lstrip()
+ return before.endswith(("==", "!=")) or after.startswith(("==", "!="))
+
+
+def _label_bearing_matrix_keys(runs_on: object) -> set[str]:
+ """Matrix keys whose value can become the runner label.
+
+ A reference that only feeds a comparison (``matrix.browser == 'webkit'``)
+ yields a boolean, and the labels are the literals around it, which the
+ ``runs-on`` text scan already covers.
+ """
+ return {
+ match.group("dot") or match.group("bracket")
+ for text in _strings(runs_on)
+ for match in MATRIX_REF_RE.finditer(text)
+ if not _is_comparison_operand(text, match)
+ }
+
+
+def _runner_sources(job: Job) -> Iterator[tuple[str, object]]:
+ runs_on = job.raw.get("runs-on")
+ if runs_on is None:
+ return
+ yield "runs-on", runs_on
+ referenced_keys = _label_bearing_matrix_keys(runs_on)
+ strategy = job.raw.get("strategy")
+ if not referenced_keys or not isinstance(strategy, dict) or not isinstance(strategy.get("matrix"), dict):
+ return
+ for key in sorted(referenced_keys):
+ yield f"strategy.matrix.{key}", list(_matrix_values_for(strategy["matrix"], key))
+
+
+def _has_generated_runner_matrix(job: Job) -> bool:
+ if not _label_bearing_matrix_keys(job.raw.get("runs-on")):
+ return False
+ strategy = job.raw.get("strategy")
+ return isinstance(strategy, dict) and isinstance(strategy.get("matrix"), str)
+
+
+def floating_labels(value: object) -> list[str]:
+ found: list[str] = []
+ for text in _strings(value):
+ for match in FLOATING_LABEL_RE.finditer(text):
+ if match.group(1) not in found:
+ found.append(match.group(1))
+ return found
+
+
+class PinnedRunnerImagesCheck(WorkflowCheck):
+ id = "WF011-pinned-runner-images"
+ label = "pinned runner images"
+ description = "runs-on and matrix runner labels name an OS version, not a floating -latest alias"
+
+ @property
+ def fix_hint(self) -> str | None:
+ return (
+ "Replace `ubuntu-latest` with `ubuntu-24.04` (or `depot-ubuntu-24.04` on Depot), and pin the "
+ "macOS/Windows aliases the same way, so an image change is a reviewed PR rather than a GitHub rollout. "
+ f"A runner matrix built by an expression needs `# {ALLOW_MARKER} -- <where the labels are pinned>` "
+ "above the job key."
+ )
+
+ def run(self, workflows: list[Workflow]) -> CheckResult:
+ result = CheckResult()
+ for wf in workflows:
+ exempt = exempt_jobs(wf.path, frozenset(job.name for job in wf.jobs), ALLOW_MARKER)
+ for job in wf.jobs:
+ if _has_generated_runner_matrix(job) and job.name not in exempt:
+ result.issues.append(
+ Issue(
+ workflow=wf.path.name,
+ job=job.name,
+ message=(
+ "runs-on takes its label from a matrix built by an expression, which the linter "
+ f"cannot inspect; pin the labels at their source and add `# {ALLOW_MARKER} -- <reason>`"
+ ),
+ file=str(wf.path),
+ )
+ )
+ for source, value in _runner_sources(job):
+ labels = floating_labels(value)
+ if not labels:
+ continue
+ result.issues.append(
+ Issue(
+ workflow=wf.path.name,
+ job=job.name,
+ message=f"{source} uses floating runner label(s) {', '.join(labels)}; pin the OS version",
+ file=str(wf.path),
+ )
+ )
+ return result
diff --git a/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py b/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py
index 0f6a4f780768..508d80cf37a7 100644
--- a/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py
+++ b/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py
@@ -55,9 +55,9 @@ from __future__ import annotations
import re
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
-from pathlib import Path
from ..check import CheckResult, Issue, WorkflowCheck
+from ..markers import exempt_jobs
from ..model import Job, Step, Workflow
ALLOW_MARKER = "hogli-lint: not-a-required-gate"
@@ -142,33 +142,6 @@ def _result_sources(job: Job) -> Iterator[str]:
yield from _env(step.raw.get("env")).values()
-def _exempt_jobs(path: Path, job_names: frozenset[str]) -> frozenset[str]:
- """Job ids carrying an allow marker, with a reason, in the comments above them."""
- lines = path.read_text(encoding="utf-8").splitlines()
- candidates: list[tuple[int, int, str]] = []
- for index, line in enumerate(lines):
- match = re.match(r"^(?P<indent>\s*)(?P<job>[A-Za-z0-9_\-]+):\s*$", line)
- if match is not None and match.group("job") in job_names:
- candidates.append((index, len(match.group("indent")), match.group("job")))
- if not candidates:
- return frozenset()
-
- exempt: set[str] = set()
- job_indent = min(indent for _, indent, _ in candidates)
- for index, indent, job in candidates:
- if indent != job_indent:
- continue
- for above in reversed(lines[:index]):
- comment = re.match(r"^(?P<indent>\s*)#(?P<body>.*)$", above)
- if comment is None or len(comment.group("indent")) != job_indent:
- break
- _, marker, reason = comment.group("body").partition(ALLOW_MARKER)
- if marker and reason.strip(" -—:"):
- exempt.add(job)
- break
- return frozenset(exempt)
-
-
def _is_gate(job: Job) -> bool:
name = job.raw.get("name")
display = name if isinstance(name, str) else job.name
@@ -551,7 +524,7 @@ class RequiredGateCheck(WorkflowCheck):
if not gates:
continue
# Only worth re-reading the file once we know there's a gate to exempt.
- exempt = _exempt_jobs(wf.path, frozenset(job.name for job in wf.jobs))
+ exempt = exempt_jobs(wf.path, frozenset(job.name for job in wf.jobs), ALLOW_MARKER)
jobs = {job.name: job for job in wf.jobs}
for job in gates:
if job.name in exempt:
diff --git a/tools/hogli-commands/hogli_commands/workflow_lint/markers.py b/tools/hogli-commands/hogli_commands/workflow_lint/markers.py
new file mode 100644
index 000000000000..ae24eefc196f
--- /dev/null
+++ b/tools/hogli-commands/hogli_commands/workflow_lint/markers.py
@@ -0,0 +1,44 @@
+"""Per-job ``# hogli-lint: <marker> -- <reason>`` comments.
+
+PyYAML drops comments, so a check that lets a job opt out with a reviewed
+reason has to read the raw file. The marker must sit in the comment block
+directly above the job key, at the job key's indent, and carry a reason.
+"""
+
+from __future__ import annotations
+
+import re
+from pathlib import Path
+
+JOB_KEY_RE = re.compile(r"^(?P<indent>\s*)(?P<job>[A-Za-z0-9_\-]+):\s*$")
+COMMENT_RE = re.compile(r"^(?P<indent>\s*)#(?P<body>.*)$")
+
+
+def exempt_jobs(path: Path, job_names: frozenset[str], marker: str) -> frozenset[str]:
+ """Job ids carrying ``marker``, with a reason, in the comments above them."""
+ lines = path.read_text(encoding="utf-8").splitlines()
+ candidates: list[tuple[int, int, str]] = []
+ for index, line in enumerate(lines):
+ match = JOB_KEY_RE.match(line)
+ if match is not None and match.group("job") in job_names:
+ candidates.append((index, len(match.group("indent")), match.group("job")))
+ if not candidates:
+ return frozenset()
+
+ exempt: set[str] = set()
+ job_indent = min(indent for _, indent, _ in candidates)
+ for index, indent, job in candidates:
+ if indent != job_indent:
+ continue
+ for above in reversed(lines[:index]):
+ comment = COMMENT_RE.match(above)
+ if comment is None or len(comment.group("indent")) != job_indent:
+ break
+ _, found, reason = comment.group("body").partition(marker)
+ if found and reason.strip(" -—:"):
+ exempt.add(job)
+ break
+ return frozenset(exempt)
+
+
+__all__ = ["exempt_jobs"]