CI/CD Pipelines

Automate build, test and deployment so every change reaches production safely and quickly.

Beginner8 min read3 interview questions

Continuous integration (CI) builds and tests every change as soon as it is pushed. Continuous delivery (CD) packages each passing change so it can be released at any time; continuous deployment releases it automatically.

A good pipeline is fast, repeatable and the only way code reaches production.

Diagram

CI — every pushCommitPRBuildcompile, lintTestunit, integ.ScanSAST, depsArtifactimage / pkgStagingsmoke testsProductionapprove
CI validates every change; CD promotes the same artifact through environments.

Key concepts

Build once, deploy many
The same artifact (container image or package) moves from staging to production, so what you tested is what you ship.
Pipeline as code
Pipelines live in the repo as YAML (GitHub Actions, Azure Pipelines, GitLab CI).
Quality gates
Tests, coverage, security scans and approvals that must pass before promotion.
Environments
Dev, staging and production with their own configuration and secrets.
Infrastructure as code
Bicep, Terraform or CloudFormation deployed by the same pipeline.

Trade-offs

Benefits

  • Small, frequent, low-risk releases
  • Bugs found minutes after they are written
  • Repeatable deployments with an audit trail

Costs

  • Pipelines need maintenance and fast test suites
  • Flaky tests erode trust quickly

Use it when

  • Every team, from day one of a project

Common mistakes

  • Rebuilding the artifact per environment
  • Secrets in pipeline YAML instead of a vault or OIDC federation
  • Manual production steps that bypass the pipeline
  • Pipelines that take an hour, so people batch changes

Interview questions

Q1Continuous delivery vs continuous deployment?
In continuous delivery every change is releasable but a person decides when to release. In continuous deployment every passing change goes to production automatically.
Q2How do you keep pipelines fast?
Cache dependencies, run test suites in parallel, run slow end-to-end tests only on main or nightly, and keep the unit-test layer large and quick.
Q3How should a pipeline authenticate to the cloud?
With workload identity federation (OIDC) and short-lived tokens rather than long-lived secrets stored in the CI system.