0
0
Jenkinsdevops~10 mins

Pipeline stages and steps in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Pipeline stages and steps
Start Pipeline
Stage 1: Build
Execute Steps in Build
Stage 2: Test
Execute Steps in Test
Stage 3: Deploy
Execute Steps in Deploy
Pipeline Complete
The pipeline starts, then runs each stage in order. Each stage runs its steps. After all stages finish, the pipeline ends.
Execution Sample
Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps { echo 'Building...' }
    }
    stage('Test') {
      steps { echo 'Testing...' }
    }
    stage('Deploy') {
      steps { echo 'Deploying...' }
    }
  }
}
This Jenkins pipeline runs three stages: Build, Test, and Deploy, each printing a message.
Process Table
StepStageStep ActionOutputPipeline State
1Buildecho 'Building...'Building...Build stage running
2BuildBuild stage completeMoving to Test stage
3Testecho 'Testing...'Testing...Test stage running
4TestTest stage completeMoving to Deploy stage
5Deployecho 'Deploying...'Deploying...Deploy stage running
6DeployDeploy stage completePipeline complete
💡 All stages completed, pipeline ends successfully
Status Tracker
VariableStartAfter BuildAfter TestAfter Deploy
Current StageNoneBuildTestDeploy
Pipeline StatusNot startedRunningRunningCompleted
Key Moments - 2 Insights
Why does the pipeline wait for all steps in a stage before moving to the next stage?
Because Jenkins runs all steps inside a stage sequentially and only moves to the next stage after completing all steps, as shown in execution_table rows 1-2 and 3-4.
What happens if a step inside a stage fails?
The pipeline stops immediately and does not proceed to the next stages. This is implied by the pipeline state changes in the execution_table where each stage completes before moving on.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pipeline state after step 3?
ABuild stage running
BTest stage running
CDeploy stage running
DPipeline complete
💡 Hint
Check the 'Pipeline State' column at step 3 in the execution_table.
At which step does the pipeline move from the Test stage to the Deploy stage?
AStep 4
BStep 2
CStep 5
DStep 6
💡 Hint
Look for the 'Moving to Deploy stage' note in the 'Pipeline State' column.
If the 'Build' stage had two steps instead of one, how would the execution table change?
AThe pipeline would skip the Test stage
BThe Deploy stage would run before Build
CThere would be two rows for the Build stage steps before moving to Test
DThe pipeline would end after the first Build step
💡 Hint
Consider how each step is represented as a row in the execution_table.
Concept Snapshot
Jenkins pipelines run in stages.
Each stage has steps executed in order.
Pipeline moves to next stage only after current stage completes.
Stages help organize and visualize pipeline progress.
Failures stop the pipeline immediately.
Full Transcript
A Jenkins pipeline runs through stages one by one. Each stage contains steps that run in order. For example, the Build stage runs its steps, then the pipeline moves to the Test stage, and finally the Deploy stage. The pipeline only moves forward after all steps in a stage finish. If any step fails, the pipeline stops. This helps organize work and track progress clearly.