Continuous Integration and trunk-based development
Small batches, integrated to trunk many times a day. Long-lived branches accumulate divergence, and the longer they live the more painful the merge. Trunk-based development with feature flags inverts the model — and HP and Bazaarvoice show what happens at scale.
- — Long-lived feature branches per developer.
- — Big merges at the end ("merge hell").
- — Trunk diverges fast; integration is a project.
- — Devs feel productive in isolation; team flow stalls.
- — Small batches merged to trunk daily.
- — Merge conflicts found while context is fresh.
- — Trunk always close to shippable.
- — Slightly more friction per dev, vastly more throughput per team.
At the end of each development interval, we must have integrated, tested, working, and potentially shippable code, demonstrated in a production-like environment, created from trunk using a one-click process, and validated with automated tests.
Gary Gruver led HP's LaserJet firmware team. Goal: 10x the time spent on new functionality. They got there through CI + trunk-based development + automated testing on every commit + automated regression every 2 / 4 / 24 hours.
Bottom line: overall development costs −40%, programs under development +140%, cost per program −78%. The technical practices paid for themselves several times over.
Bazaarvoice migrated their large legacy codebase to CI + trunk-based development. The outcomes were the same shape as HP — dramatic increase in deploy frequency, dramatic drop in deploy failure rate, and a culture that started shipping in small batches by default. The general lesson: CI works even on big legacy codebases; you don't have to be a greenfield startup.
download Case study · Bazaarvoice CI (2012) · PDF ~500 KBA team works on long-lived feature branches "to avoid breaking trunk." Merges take 2–3 days every two weeks. What does the DevOps Handbook predict?
// pick one to verify
HP's LaserJet team went from 5% to 40% of dev time spent on innovation. The other 60% used to be:
// pick one to verify