Process Flow - Steps within stages
Start Pipeline
Enter Stage
Execute Step 1
Execute Step 2
Execute Last Step
Exit Stage
Next Stage or End Pipeline
The pipeline starts, enters a stage, runs each step in order, then exits the stage and moves on.
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Compiling code'
sh 'make build'
}
}
}
}| Step | Action | Command/Message | Result/Output |
|---|---|---|---|
| 1 | Enter Stage | Build | Stage 'Build' started |
| 2 | Execute Step | echo 'Compiling code' | Prints: Compiling code |
| 3 | Execute Step | sh 'make build' | Runs build command, outputs build logs |
| 4 | Exit Stage | Build | Stage 'Build' completed |
| Variable | Start | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|
| Stage Status | Not started | Running | Running | Completed |
| Build Output | None | Compiling code printed | Build logs generated | Build logs available |
Jenkins pipeline stages contain steps. Steps run one by one inside a stage. Each step executes a command or action. If a step fails, the stage stops. Stages help organize pipeline tasks clearly.
steps inside a Jenkins stage?steps { ... } block.echo command prints messages in Jenkins pipelines.stage('Build') {
steps {
echo 'Starting build'
sh 'echo Build complete'
}
}echo 'Starting build', then shell command sh 'echo Build complete'.stage('Test') {
steps
echo 'Running tests'
}steps { ... }.sh step by separating them with semicolons.steps block is allowed per stage; multiple commands go inside one sh step or multiple steps inside the block.sh step with commands separated by semicolons inside steps { } -> Option APass the test and this pattern moves unknown