CI/CD Fundamentals
CI/CD turns every change into a tested, deployable release automatically — the heart of DevOps.
On this page · 5 min · Intermediate
On this page
- Learning objectives
- Explanation
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Intermediate
- Updated
- Oct 29, 2026
Related tutorials
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#
┌────────── 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)
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#
- CI runs on every pull request.
- Merging to main starts CD.
- One versioned artifact is promoted through environments.
- 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#
Different builds can behave differently. Build once, configure per environment.
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
Continuous delivery.
Mini quiz#
What does “build once, deploy many” mean?
Want more? Practise all DevOps MCQs · DevOps interview questions
My notes#
Saved in this browser.