Stages run in order
Each stage waits for the one before it to finish. If any stage fails, the rest are skipped.
Red and green
A passing stage shows green. A failing stage shows red. A pipeline is only done when every stage is green.
A pipeline is made of stages. Each stage is a step that runs in order. The most common stages are install, test, build, and deploy.
About 1 min of reading
Before this new lesson, one small question about the lesson you just finished. Recall it, do not look it up.
A pipeline is made of stages that run in order. I walk through a four-step pipeline, stop as soon as a stage turns red, then check whether every stage is green to decide whether the code can ship.
The most common stages are install, test, build, and deploy, and they run one after another. I loop through the stages and print each one as it runs.
Before you run it, say out loud what it will print. Then open the answer.
As soon as a stage turns red, the pipeline stops and the later stages never run. I run the steps one by one, fail the test step, and print that the build step is skipped.
Before you run it, say out loud what it will print. Then open the answer.
Every stage reports green or red, and the pipeline is only done when all four are green. I set each stage to green and print that the code reaches production only when they all pass.
Before you run it, say out loud what it will print. Then open the answer.
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.
Each stage waits for the one before it to finish. If any stage fails, the rest are skipped.
A passing stage shows green. A failing stage shows red. A pipeline is only done when every stage is green.
# A tiny pipeline
- install: pip install -r requirements.txt
- test: pytest
- build: make package
- deploy: ship it
If the test step fails, the pipeline stops. The build and deploy steps never run. This keeps bad code from shipping.
jobs:
build:
steps:
- run: npm install
- run: npm test # <-- this fails
- run: npm run build # never reached
As soon as a stage turns red, the pipeline stops. The later stages are skipped. You see exactly which step broke.
Every stage reports its own status: green for pass, red for fail.
Only when all four are green does the code reach production.
Each one is defined here on this site. Open the entry for the full definition and the other words it points at.