CI/CD pipeline design

Build → test → scan → deploy stages, caching, artifacts, environment promotion. Fast pipelines are a feature.

About 29 min read3-question knowledge check

The mental model

A CI/CD pipeline is an assembly line for confidence. Code enters at one end as a commit; a release artifact leaves at the other end. Every station on the line either adds something to the artifact (compile, package) or tries to reject it (lint, test, scan). Nothing moves forward until the station before it passes.

The analogy that sticks: an airport. Check-in is your commit. Security screening is the fast checks — lint, type-check, unit tests — cheap, run on everyone, catch the obvious problems in seconds. The gate is integration tests. Boarding is the deploy to staging. Takeoff is production. Two rules from the airport apply directly to pipelines: screen early because rejecting a passenger at the gate is far more expensive than at check-in, and the plane leaves with exactly the bags that were screened — you deploy the artifact you tested, never a rebuild.

Three ideas carry the whole discipline:

  • Build once, promote many. One artifact — a container image with an immutable digest — flows through dev → staging → prod. If each environment rebuilds from source, you are testing three different things and calling them one release.
  • Fast feedback is a feature. A pipeline over roughly 10 minutes stops being a feedback loop and becomes an interruption; engineers context-switch, batch their merges, and the batches get riskier.
  • **The pipeline is the only path to production.** The moment a human can scp a jar to a server, every guarantee the pipeline provides is a suggestion.

CI (continuous integration) is the part that proves the merged code is sound. CD splits into continuous delivery (every green build is deployable, a human clicks) and continuous deployment (every green build ships automatically). Most teams do delivery to prod and deployment to staging — say that in an interview rather than using CD as one blurry word.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision