DevOps · CI/CD

CI/CD Fundamentals

CI/CD turns every change into a tested, deployable release automatically — the heart of DevOps.

Intermediate 5 min Lesson 9 of 30
Before you start:Introduction to DevOps
0/30 in DevOps
On this page · 5 min · Intermediate

Learning objectives#

  • Define CI, continuous delivery and continuous deployment
  • Describe pipeline stages
  • Explain build once, deploy many
  • Add quality gates

Explanation#

Continuous integration (CI): every change is merged often and automatically built and tested.

Continuous delivery: every passing build is releasable; a person approves production. Continuous deployment: it goes to production automatically.

Build once, deploy many: create one artifact (zip or container image) and promote the same artifact through dev, staging and production.

Quality gates stop the pipeline: failed tests, low coverage, security findings or a failed staging smoke test.

Code example: A typical pipeline#

TextA typical pipeline Illustrative
┌────────── CI (every PR) ──────────┐   ┌──────────── CD (main) ─────────────┐
 checkout → restore → build → test →     build image → push v1.4.0 → deploy staging
 lint → security scan → ✔ checks         → smoke test → approval → deploy prod
                                          (same image v1.4.0 in every environment)
Expected output
Broken code never merges; the exact image tested in staging is the one released to production.

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. CI runs on every pull request.
  2. Merging to main starts CD.
  3. One versioned artifact is promoted through environments.
  4. Gates and approvals protect production.

Real-world use case#

An e-commerce team deploys many times a day; each deploy is small and can be rolled back in a minute.

Common mistakes#

Rebuilding for each environment

Different builds can behave differently. Build once, configure per environment.

Slow pipelines

If CI takes 40 minutes, people avoid it. Parallelise and cache.

Best practices#

  • Keep CI under ~10 minutes
  • Build once, promote the same artifact
  • Configuration via environment variables
  • Automate rollback

Remember this#

CI = integrate + test continuously.

Delivery = always releasable; deployment = released automatically.

Build once, deploy many.

Practice exercise#

Your task: Is “a person clicks Approve before production” continuous delivery or continuous deployment?

Show solution
Text Illustrative
Continuous delivery.

Mini quiz#

CI/CD Fundamentals quizMultiple choice Question 1 of 1

What does “build once, deploy many” mean?

Score so far: 0/0

Want more? Practise all DevOps MCQs · DevOps interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.