Book Deep-Read · Software Engineering at Google · Chapter 23

Continuous Integration

Software Engineering at Google · Ch 23 · Continuous Integration · Rachel Tannenbaum · 2020

中文 →

What is this chapter about?

Tens of thousands of engineers push changes into the same software every day. Any one of those changes can break somebody else's work. This chapter is about how Google lets machines stand guard instead of people: every incoming change is automatically assembled and checked, and the earlier a bad change is caught, the better. That practice is called "continuous integration."

A strange thing first

You'd think the safest approach is "before any change goes in, run every single check, and only let it in if everything passes." Google deliberately doesn't. Before a change goes in, it runs only a small handful of fast, dependable checks and lets it in first; the big checks run afterwards. If something turns out wrong, the change is undone with a click. The result is both faster and steadier.

Why the old world was hard

Picture a restaurant kitchen. If every dish had to pass a full inspection before leaving the stove, cooks would spend most of their time waiting, the food would go cold, and the guests would leave. If nothing were checked, problems would surface only when a guest phoned in a complaint — by which point it's hard to tell which cook, at which step, went wrong. The later a problem is found, the harder and costlier it is to trace. Worse, some checks are themselves "sometimes right, sometimes wrong," blaming innocent cooks — and soon nobody trusts them.

The core mechanism, intuitively

What it buys you / how to choose

Every day more than fifty thousand changes and over four billion checks pass through this system at Google, and engineers wait only about ten minutes on average to hand a change in. A small company needn't copy all of it, but it should ask how much it already pays for problems that only show up after launch. The honest cost: the checking machinery itself takes lots of machines and people to maintain, and it will never be perfectly error-free.

One line to remember

Continuous integration isn't "check everything, then let it in"; it's deciding "what to check, when": fast and reliable checks first, slow and difficult ones later, and undo on error.

Want to see why presubmit isn't enough, how "CI is alerting" rewrites green-build policies, the hermetic-testing and record/replay trade-offs, how TAP finds culprits among 50,000 changes a day, and Takeout's four CI makeovers? → Switch to deep read