ref(ci): parallel devservices startup and more robust bootstrap-snuba#112381
ref(ci): parallel devservices startup and more robust bootstrap-snuba#112381
Conversation
setup-sentry takes ~2min per backend test shard, with ~90s spent on devservices (Docker image pulls + container health checks). This all runs serially after Python/venv setup, even though image pulls don't depend on the venv at all. Add a setup-devservices composite action that: - Parses uv.lock (via tomllib) for the pinned devservices version - Installs it into an isolated /tmp venv using system Python - Starts `devservices up` in the background immediately after checkout The full setup-sentry venv restore (~19s) now runs concurrently with Docker image pulls. A wait script polls for completion with proper error handling and timeout. Also extract the Snuba per-worker bootstrap into a two-phase script: - Phase 1 (early): Polls for ClickHouse readiness and runs the expensive `bootstrap --force` while devservices is still bringing up remaining containers - Phase 2 (after devservices): Stops the default Snuba container and starts per-worker API instances Net saving: ~25-35s per shard depending on container startup order.
Apply the same early-devservices pattern from the backend test change. Acceptance tests have several minutes of webpack/node build between checkout and setup-sentry, so devservices will be fully ready by the time the venv is set up — the entire ~90s of container startup becomes free.
Apply the same overlap pattern to every workflow that uses setup-sentry: backend-migration-tests, cli, api-docs, api-url-typescript, migration, monolith-dbs, migrations, migrations-drift, openapi, and openapi-diff.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e8287ab. Configure here.
- Use strict shell (set -euo pipefail) at action level - Fix set -e preventing exit code file from being written in subshell - Add 10-minute timeout to Snuba bootstrap wait loop - Move devservices start after chartcuterie build in acceptance - Revert migrations/migrations-drift (checkout master first, action doesn't exist there yet)
This reverts commit c8766fe.
This reverts commit 4325402.
This reverts commit 6d20efb.
| @@ -0,0 +1,38 @@ | |||
| name: 'Early Devservices' | |||
There was a problem hiding this comment.
nit: This action + wait.sh could live inside setup-sentry instead of being a separate action. setup-sentry already has skip-devservices and devservices-timeout-minutes inputs. We can add a parallel-devservices mode to let it start the background process early (before venv setup) and
wait at the end (where it currently runs devservices up synchronously). I notice we're repeating the same 3-step pattern across all the 10 or so jobs, but just parallel-devservices: 'true' on the existing setup-sentry step would be a lot easier
There was a problem hiding this comment.
i would like to cut down on the boilerplate too but we'd lose most of the benefit for acceptance because webpacking requires setup-sentry and we want to be pulling stuff while webpacking
There was a problem hiding this comment.
sure, let's just tackle this later.
…#112381) `setup-sentry` takes ~2min per backend and acceptance test shard - most of this overhead is ~90s container setup this intros a new `setup-devservices` composite action which `devservices up` in the background immediately after checkout, no setup-sentry required cause we can just parse `devservices` version from uv.lock with stdlib python i'm observing ~30-40s saved per acceptance test shard and similar numbers for backend and the rest

setup-sentrytakes ~2min per backend and acceptance test shard - most of this overhead is ~90s container setupthis intros a new
setup-devservicescomposite action whichdevservices upin the background immediately after checkout, no setup-sentry required cause we can just parsedevservicesversion from uv.lock with stdlib pythoni'm observing ~30-40s saved per acceptance test shard and similar numbers for backend and the rest
example: https://github.com/getsentry/sentry/actions/runs/24096487514/job/70296340867
time to start running acceptance tests is 1m50s
before: ~2m30s https://github.com/getsentry/sentry/actions/runs/24096224167/job/70295443714
backend: ~45s saved!
before https://github.com/getsentry/sentry/actions/runs/24096491312/job/70296457386 2m45s before tests run
after https://github.com/getsentry/sentry/actions/runs/24096896697/job/70297892709: 2m before tests run
also applies to the rest of the setup-sentry callers: backend-migration-tests, cli, api-docs, api-url-typescript, migration, monolith-dbs, migrations, migrations-drift, openapi, openapi-diff