Project
Canary CI cache
A content-addressed build cache that cut CI time from 14 to 3 minutes without changing a single Dockerfile.
The problem
Fourteen-minute CI runs, 80% of them spent re-compiling unchanged inputs.
Classic solution is Docker layer caching, but our monorepo touched Go source
on every commit, blowing the cache from layer 2 onward.
Design
Content-addressed cache keyed on a merkle hash of inputs:
- Input hashing:
go.mod+go.sum+ source tree fingerprint (git
tree hash) → cache key. A commit that only edits docs reuses everything. - Storage: S3-compatible blob store; entries are gzipped tarballs of
$GOCACHEand$GOMODCACHE. - Fallback: on miss, build as before and publish. Cache-aside, never
cache-through, so a poisoned entry can be deleted without ceremony.
Results
Median pipeline time: 14 min → 3 min. Cache hit rate stabilized at 87%.
The interesting failure mode was flaky test pollution — cached test results
were never trusted; tests always run fresh, only compilation is cached.