CI/CD: Concepts and Pipeline

9 min

Table of contents


1 — What is CI/CD?

CI/CD is the technical backbone of DevOps. It is the set of practices that automate the path from “code written by a developer” to “the application running in production”.

AcronymNameIn one sentence
CIContinuous IntegrationWe merge and test the code often and automatically.
CDContinuous DeliveryThe tested code is always ready to be deployed (manual production release).
CDContinuous DeploymentThe tested code goes automatically to production.

Without CI/CD, shipping software feels like moving house by hand: slow, tiring, and risky. With CI/CD, it is an automated conveyor belt: you put the code in at one end, the application arrives ready at the other.

🔧 Mini-exercise — Match each acronym to its definition: (1) CI, (2) Continuous Delivery, (3) Continuous Deployment.

✅ See a solution

(1) CI = frequent automatic merge + build + tests. (2) Continuous Delivery = always ready to deploy, manual button for production. (3) Continuous Deployment = automatic production release after successful tests.

↑ Back to top


2 — CI — Continuous integration

Continuous integration means merging frequently every developer's code into a shared branch, and automatically validating each merge with a build and tests.

Why “continuous”?

Without CIWith CI
Everything is merged at the end of the month → painful large conflictsSeveral merges per day → small, easy conflicts
Bugs are found lateBugs are found in minutes
“It worked on my machine”Reproducible build on the server

Analogy: tidy the kitchen as you go (CI) rather than waiting until everything is dirty (“big bang” integration). The small frequent effort avoids the rare catastrophe.

🔧 Mini-exercise — A developer keeps their code for 3 weeks without merging, then attempts a large merge. Which continuous-integration principle did they ignore, and what consequence is likely?

✅ See a solution

They did not merge frequently. Likely consequence: a massive merge conflict that is hard to resolve, and bugs detected very late. CI recommends small, frequent merges.

↑ Back to top


3 — CD — Continuous delivery vs continuous deployment

The two “CD”s look alike but differ on a single point: who presses the production-release button.

Continuous DeliveryContinuous Deployment
Production releaseManual (a human clicks)Automatic
ControlFinal human decisionNo intervention
Ideal forRegulated sectors, planned releasesMature teams, strong test coverage

Continuous Delivery = the car is parked at the door, ready, keys in the ignition; you decide when to start. Continuous Deployment = the self-driving car starts on its own as soon as it is ready.

🔧 Mini-exercise — A bank wants every production release to be approved by a manager. Which “CD” should they choose?

✅ See a solution

Continuous Delivery: the pipeline makes the version ready automatically, but the production release remains a human decision (manager approval).

↑ Back to top


4 — The CI/CD pipeline step by step

A pipeline is a sequence of automated steps (called stages) that turn source code into a deployed application. If a stage fails, the pipeline stops and the team is notified.

StageRoleExample tool
CheckoutGet the code from GitGit
BuildCompile / assembleMaven, npm, javac
TestVerify automaticallyJUnit, pytest
PackageProduce a shippable artifact.jar, Docker image
StagingDeploy to pre-productiontest server
DeployRelease to productionserver / cloud

The “fail fast” principle: put the cheap, fast stages (compilation, unit tests) first. There is no point deploying if the code does not even compile.

🔧 Mini-exercise — In which order should you place these stages: Deploy, Build, Test, Checkout?

✅ See a solution

CheckoutBuildTestDeploy. Get the code, compile it, test it, and deploy only if everything is green.

↑ Back to top


5 — A concrete end-to-end example

Let's follow the path of a single line of code fixed by a developer, Léa, in a web application.

Step-by-step walkthrough:

  1. Léa fixes a bug and runs git push.
  2. A webhook tells the CI/CD server that there is new code.
  3. The pipeline compiles, runs the 124 tests (all green), then packages version v1.4.1.
  4. The version is deployed automatically.
  5. Six minutes after the push, the fix is live — with no manual intervention.

Compare: before CI/CD, this same fix would have required a scheduled production release, one evening, by hand, with the stress of “hope it works”. Here, it is a 6-minute routine.

🔧 Mini-exercise — At step 3, 2 tests out of 124 fail. What does the pipeline do, and does the version go to production?

✅ See a solution

The pipeline stops at the Test stage, notifies Léa, and does not deploy. Production stays on the previous stable version. That is the “fail fast” principle protecting production.

↑ Back to top


6 — The benefits of automation
BenefitWhat it changes in practice
Fewer human errorsRepetitive tasks are scripted: no more forgotten steps
Fast feedbackYou know in minutes whether a change breaks something
Frequent deploymentsYou can ship several times a day with confidence
ReproducibilityEvery build is identical — no more “it works on my machine”
TraceabilityEvery change is recorded: who, what, when

The more often you deploy, the smaller each deployment is, and therefore the less risky. It is counter-intuitive: deploying more often makes deployments safer, not more dangerous.

🔧 Mini-exercise — Give two reasons why deploying small changes 10 times a day is less risky than a single large monthly deployment.

✅ See a solution
  1. Each deployment contains little code → a bug is easy to locate. 2) Rollback is simple (few changes to undo). A large monthly deployment concentrates a lot of risk at once.

↑ Back to top


7 — Quiz — CI/CD concepts

Question 1: What does “CI” stand for?

a) Code Inspection

b) Continuous Integration

c) Container Initialization

d) Central Infrastructure

See the solution

Answer: b)Continuous Integration: frequent automatic merge and validation of the code.


Question 2: What is the difference between Continuous Delivery and Continuous Deployment?

a) None, they are synonyms

b) In Delivery the production release is manual; in Deployment it is automatic

c) Deployment does not run tests

d) Delivery deploys automatically

See the solution

Answer: b) — Both prepare a ready version; only the production release differs (manual vs automatic).


Question 3: What happens if the Test stage fails in a pipeline?

a) The pipeline continues all the way to production anyway

b) The pipeline stops and the team is notified

c) The code is deleted from the repository

d) The pipeline restarts forever

See the solution

Answer: b) — “Fail fast” principle: a failure stops the pipeline and triggers an alert; nothing goes to production.


Question 4: What is an artifact in a pipeline?

a) A bug introduced by mistake

b) The packaged result of a build (e.g. a .jar, an image)

c) A message in the logs

d) A user of the system

See the solution

Answer: b) — The artifact is the deliverable produced by the build, ready to be deployed.


Question 5: Why does deploying often make deployments safer?

a) Because each deployment is smaller and therefore easier to diagnose and roll back

b) Because we remove the tests

c) Because the servers become more powerful

d) Because users do not notice

See the solution

Answer: a) — Small frequent changes reduce the risk surface and make rollback easier.

↑ Back to top


8 — Practice — Design your first pipeline

Instructions

A team is developing a Java application. Design (on paper / as a pseudo-pipeline) the stages of a CI/CD pipeline for this application, indicating for each stage: its name, its role, and what should stop the pipeline. Also specify whether you recommend Continuous Delivery or Continuous Deployment, and why.


Suggested correction

OrderStageRoleStop condition
1CheckoutGet the code from GitRepository unreachable
2BuildCompile with Maven (mvn package)Compilation error
3TestRun the JUnit testsA test fails
4PackageProduce the .jar / image artifactPackaging failure
5StagingDeploy to pre-productionApplication startup fails
6DeployRelease to productionManual validation refused

Recommended choice to start: Continuous Delivery.

Rationale: until test coverage is mature, keep a human validation before production (Delivery). When the team trusts its automated tests, it can move to Continuous Deployment (automatic production release).

Expected diagram:

↑ Back to top


9 — Summary

Key takeaways

  1. CI/CD = automating the path from code to production, the technical heart of DevOps.
  2. CI: merge and test often and automatically.
  3. CD: Delivery (ready to deploy, manual button) vs Deployment (automatic production release).
  4. The pipeline chains stages; a failure stops everything (fail fast).
  5. Deploy often and small = less risk, fast feedback, easy rollback.

What's next

Lesson 04 — Deployment strategies: how to go from v1 to v2 in production without breaking the service (Blue/Green, Canary, Rolling…).

↑ Back to top


All rights reserved. Any reproduction, distribution, use or adaptation of this course, in whole or in part, is strictly prohibited without the prior written authorization of Dr. Haythem REHOUMA.

Course created by Dr. Haythem REHOUMA — Development and Deployment of Data Solutions