Process Flow - Build, test, deploy stages concept
Start Pipeline
Build Stage
Test Stage
Deploy Stage
Pipeline Complete
The pipeline runs in order: first building the code, then testing it, and finally deploying it if tests pass.
pipeline {
agent any
stages {
stage('Build') { steps { echo 'Building...' } }
stage('Test') { steps { echo 'Testing...' } }
stage('Deploy') { steps { echo 'Deploying...' } }
}
}| Step | Stage | Action | Output | Next Step |
|---|---|---|---|---|
| 1 | Build | Start Build stage | Building... | Go to Test stage |
| 2 | Test | Start Test stage | Testing... | Go to Deploy stage |
| 3 | Deploy | Start Deploy stage | Deploying... | Pipeline Complete |
| 4 | End | Pipeline finished | All stages completed successfully | Stop |
| Variable | Start | After Build | After Test | After Deploy |
|---|---|---|---|---|
| stageStatus | none | build complete | test complete | deploy complete |
Jenkins pipeline runs stages in order: Build -> Test -> Deploy. Each stage must succeed for the next to run. If a stage fails, pipeline stops to prevent errors. Stages print messages to show progress. This ensures safe, step-by-step delivery of code.
build, test, and deploy stages?build stage in a Jenkins declarative pipeline?stage('name') { steps { ... } }.stage('build') { steps { sh 'make build' } }.pipeline {
agent any
stages {
stage('build') {
steps {
echo 'Building...'
}
}
stage('test') {
steps {
error 'Test failed!'
}
}
stage('deploy') {
steps {
echo 'Deploying...'
}
}
}
}error 'Test failed!' which stops the pipeline with failure.pipeline {
agent any
stages {
stage('build') {
steps {
sh 'make build'
}
}
stage('test') {
sh 'make test'
}
stage('deploy') {
steps {
sh 'make deploy'
}
}
}
}steps { ... } blocks, but test stage does not.steps block to run commands; missing it causes failure.test stage is missing the steps block -> Option Bpost { success { ... } } to confirm deployment success message, matching requirement.Pass the test and this pattern moves unknown