0
0
Jenkinsdevops~10 mins

Hybrid CI/CD approaches in Jenkins - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Hybrid CI/CD approaches
Code Commit
Trigger CI Pipeline
Build & Test
Decision: Auto Deploy or Manual Approval?
Auto Deploy
Deploy to Prod
Deploy to Prod
Code is committed, triggering CI build and tests. Then deployment can be automatic or wait for manual approval before deploying.
Execution Sample
Jenkins
pipeline {
  agent any
  parameters {
    booleanParam(name: 'AUTO_DEPLOY', defaultValue: false, description: 'Automatically deploy after build')
  }
  stages {
    stage('Build & Test') {
      steps { echo 'Building and Testing...' }
    }
    stage('Deploy') {
      steps {
        script {
          if (params.AUTO_DEPLOY) {
            echo 'Deploying automatically'
          } else {
            input 'Approve Deployment?'
            echo 'Deploying after approval'
          }
        }
      }
    }
  }
}
Jenkins pipeline that builds and tests code, then deploys automatically or waits for manual approval based on a parameter.
Process Table
StepActionConditionResultOutput
1Code commit triggers pipelineN/APipeline startsBuild & Test stage begins
2Build & Test stage runsN/ABuild and tests succeedOutput: 'Building and Testing...'
3Check AUTO_DEPLOY parameterAUTO_DEPLOY == true?True branchOutput: 'Deploying automatically'
4Deploy stage completesN/ADeployment done automaticallyPipeline ends
5Alternative: AUTO_DEPLOY == falseFalse branchWait for manual approvalPipeline pauses for input
6Manual approval givenN/ADeployment proceedsOutput: 'Deploying after approval'
7Deploy stage completesN/ADeployment done after approvalPipeline ends
💡 Pipeline ends after deployment either automatically or after manual approval.
Status Tracker
VariableStartAfter Step 3After Step 5Final
AUTO_DEPLOYundefinedtrue or false (depends on param)false (if manual approval path)true or false (final deployment path)
Key Moments - 2 Insights
Why does the pipeline pause at step 5?
At step 5, if AUTO_DEPLOY is false, the pipeline waits for manual approval using the input step, pausing execution until approval is given (see execution_table row 5).
What happens if AUTO_DEPLOY is true?
If AUTO_DEPLOY is true at step 3, the pipeline skips manual approval and deploys automatically (execution_table row 3 and 4).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what output appears at step 2?
A'Deploying automatically'
B'Approve Deployment?'
C'Building and Testing...'
D'Deploying after approval'
💡 Hint
Check the 'Output' column for step 2 in the execution_table.
At which step does the pipeline wait for manual approval?
AStep 5
BStep 3
CStep 6
DStep 7
💡 Hint
Look for the step where the pipeline pauses for input in the execution_table.
If AUTO_DEPLOY is set to false, what is the output at step 6?
A'Deploying automatically'
B'Deploying after approval'
C'Building and Testing...'
D'Pipeline ends'
💡 Hint
Refer to the output column at step 6 in the execution_table.
Concept Snapshot
Hybrid CI/CD pipelines combine automatic and manual deployment steps.
Code commit triggers build and test stages.
Deployment can be automatic or wait for manual approval.
Use parameters to control deployment flow.
Manual approval pauses pipeline until confirmed.
This approach balances speed and control.
Full Transcript
In hybrid CI/CD approaches, when code is committed, the pipeline starts by building and testing the code. After successful tests, the pipeline decides whether to deploy automatically or wait for manual approval based on a parameter called AUTO_DEPLOY. If AUTO_DEPLOY is true, deployment happens immediately. If false, the pipeline pauses and waits for a human to approve before deploying. This method combines fast automation with safety checks. The Jenkins pipeline example shows these steps clearly, with outputs indicating each stage's progress. Variables like AUTO_DEPLOY control the flow, and the pipeline ends after deployment completes either way.