Basic

What is CI/CD?

CI/CD stands for Continuous Integration and Continuous Delivery. It is a set of practices that let teams test and ship code automatically. CI runs tests when you write code. CD ships the working code to users.

What you will see

Test failed. Merge blocked. Bug caught before users.

About 2 min of reading

Try It

CI/CD stands for Continuous Integration and Continuous Delivery. I run a small pipeline story, show what happens with only one of the two halves, then catch a bug before it ships so I can see why the two pieces belong together.

1

A pipeline does the whole job by itself. I print what a teammate hears when they push a change: the tests run, turn green, the code deploys, and finally the update is live for users.

def pipeline(): print("Running tests... all green. Deploying to the test server.") print("The update is live for users.") pipeline()

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Running tests... all green. Deploying to the test server. The update is live for users.
No one runs the tests by hand in a real pipeline. The pipeline runs them every time you push, which is the heart of CI/CD.
2

CI gives confidence and CD gives speed, but neither is useful on its own. I print what each half looks like by itself and then what they look like joined together.

ci = "tests pass" cd = "code ships" print(f"CI without CD: {ci}, but no release.") print(f"CD without CI: {cd}, but nobody knows if it works.") print(f"Together: {ci + ' and ' + cd}")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
CI without CD: tests pass, but no release. CD without CI: code ships, but nobody knows if it works. Together: tests pass and code ships
You need both. CI without CD means tests pass but someone ships by hand; CD without CI means you ship fast with no confidence it works.
3

A pipeline stops a broken change before users see it. I write a test that looks for an error in some code and print that the merge is blocked so the bug is fixed in minutes instead of reaching users.

def test(code): return "error" in code.lower() if test("return a / b"): print("Test failed. Merge blocked. Bug caught before users.") else: print("Tests passed. Merge allowed.")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Test failed. Merge blocked. Bug caught before users.
Early feedback is the whole point of CI. A missing check in a feature is exactly the kind of bug this catches before it grows.

Put it in order

Before you write anything, put these lines back in the right order. Click a line to move it up one step. This support step is easier than writing code from scratch, and it is here to make the last example stick.

Data Flow

You push code, CI tests it, and if it passes, CD sends it to users.
1 You push code
↓
2 CI runs tests
↓
3 Tests pass or fail
↓
4 CD deploys if green
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

def pipeline(): sets nothing on screen
print("Running tests... all green. Deploying to the test server.") Running tests... all green. Deploying to the test server.
print("The update is live for users.") The update is live for users.
pipeline() sets nothing on screen
Why this works
Continuous Integration

CI means developers merge their work often. Every merge runs tests automatically. Problems are caught early, before they grow.

Continuous Delivery

CD means the tested code can be released safely at any time. Sometimes it deploys by itself. This is how fast teams ship code.

Examples

A simple pipeline story

You: "I changed three files."
CI: "Running tests... all green. Deploying to the test server."
CD: "The update is live for users."

No one has to run the tests by hand. The pipeline does it every time. This is the heart of CI/CD.

Two words, one flow

CI  = the tests. It runs every time you write code.
CD  = the release. It sends good code to users.

CI without CD: tests pass, but someone ships by hand.
CD without CI: you ship fast, but nobody knows if it works.

You need both. CI gives confidence. CD gives speed. Together they let a team ship safely.

A bug caught early

A teammate adds a feature but forgets a check. The pipeline runs, the test fails, and the merge is blocked.

That bug would have reached users on their own. Instead, the team fixes it in three minutes. Early feedback is the whole point of CI.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

Next Lesson
The parts of a pipeline
The parts of a pipeline →