0
0
Jenkinsdevops~10 mins

Steps within stages in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
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.
Execution Sample
Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        echo 'Compiling code'
        sh 'make build'
      }
    }
  }
}
This pipeline runs a 'Build' stage with two steps: printing a message and running a build command.
Process Table
StepActionCommand/MessageResult/Output
1Enter StageBuildStage 'Build' started
2Execute Stepecho 'Compiling code'Prints: Compiling code
3Execute Stepsh 'make build'Runs build command, outputs build logs
4Exit StageBuildStage 'Build' completed
💡 All steps in the 'Build' stage executed successfully, stage ends.
Status Tracker
VariableStartAfter Step 2After Step 3Final
Stage StatusNot startedRunningRunningCompleted
Build OutputNoneCompiling code printedBuild logs generatedBuild logs available
Key Moments - 2 Insights
Why do steps run one after another inside a stage?
Steps inside a stage run sequentially as shown in the execution_table rows 2 and 3, ensuring each command finishes before the next starts.
What happens if a step fails inside a stage?
If a step fails, the pipeline stops executing further steps in that stage, so the exit step (row 4) would not be reached.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the output after Step 2?
ARuns build command
BPrints: Compiling code
CStage 'Build' completed
DNo output yet
💡 Hint
Check the 'Result/Output' column for Step 2 in the execution_table.
At which step does the stage status change to 'Completed'?
AStep 2
BStep 3
CStep 4
DStart of pipeline
💡 Hint
Look at the variable_tracker row for 'Stage Status' and see when it becomes 'Completed'.
If the 'sh make build' command fails, what happens next?
AStage exits immediately without completing all steps
BStage restarts automatically
CPipeline continues to next step
DPipeline skips to next stage
💡 Hint
Refer to key_moments explanation about step failure stopping the stage.
Concept Snapshot
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.
Full Transcript
In Jenkins pipelines, a stage groups related steps. When the pipeline runs, it enters a stage and executes each step in order. For example, in the 'Build' stage, it first prints a message, then runs a build command. Each step must finish before the next starts. If any step fails, the stage stops immediately. After all steps complete, the stage ends and the pipeline moves on. This flow helps organize tasks and track progress clearly.