- All playbooks
- Caching and setup
- Bake stable dependencies into runner images
Bake stable dependencies into runner images
Prepare versioned system dependencies and build downloads once in the runner image instead of installing them on every job.
How companies used this technique
Read what each company changed and follow the original sources.
Bake versioned build downloads into the runner image
Bun bakes a read-only prefetch store of its dependency tarballs, WebKit prebuilt and zig compiler into its build images. A build copies a prefetched file when its URL matches and downloads from the network when a version has changed.
Before the change every CI build downloaded about 18 archive tarballs, a 200 MB WebKit prebuilt and a zig compiler before compiling. Source
- Use it when
- Builds on fresh runners download the same large, versioned inputs on every run, and you control the runner image.
- Before applying it
- Entries are keyed by exact URL or version, so a bumped dependency downloads fresh until the image is refreshed.
Bake stable system dependencies into the CI image
Each API test shard spent 7 to 8 seconds installing the same Postgres client with apt. Linear moved it into a small CI base image with Node and the client, and later added the native build headers whose downloads could occasionally hang.
Together, the CI base image, the filtered install and dropping the node_modules cache reduced per-shard setup time by roughly 44%, from 110-140 seconds to 67-73 seconds. Source
- Use it when
- Multiple jobs repeat stable OS-package setup on equivalent environments.
- Before applying it
- Pin and rebuild the image, patch vulnerabilities and measure image-pull cost. Repository secrets and mutable build outputs do not belong in the image.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed