0
0
Jenkinsdevops~10 mins

Blue-green deployment pattern in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the two environments used in blue-green deployment.

Jenkins
def deployTo[1]() {
    echo 'Deploying to environment'
}
Drag options to blanks, or click blank then click option'
Agreen
Bblue
Ctest
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'test' or 'prod' instead of 'blue' or 'green'.
2fill in blank
medium

Complete the code to switch traffic to the new environment in blue-green deployment.

Jenkins
stage('Switch Traffic') {
    steps {
        script {
            sh 'kubectl [1] service blue-service green-service'
        }
    }
}
Drag options to blanks, or click blank then click option'
Apatch
Breplace
Cdelete
Drollout
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' which removes the service, causing downtime.
3fill in blank
hard

Fix the error in the Jenkins pipeline step to deploy to the green environment.

Jenkins
stage('Deploy Green') {
    steps {
        [1] 'deploy-green.sh'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bpowershell
Cbat
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bat' which is for Windows batch scripts.
4fill in blank
hard

Fill both blanks to create a Jenkins stage that deploys to blue and green environments sequentially.

Jenkins
stage('Deploy Both') {
    steps {
        [1] 'deploy-[2].sh'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bbat
Cblue
Dgreen
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bat' on Unix agents or wrong environment name.
5fill in blank
hard

Fill all three blanks to define a Jenkins pipeline snippet that deploys to green, switches traffic, and verifies deployment.

Jenkins
pipeline {
    agent any
    stages {
        stage('Deploy Green') {
            steps {
                [1] 'deploy-green.sh'
            }
        }
        stage('Switch Traffic') {
            steps {
                script {
                    sh 'kubectl [2] service blue-service green-service'
                }
            }
        }
        stage('Verify') {
            steps {
                [3] 'curl -f http://green.example.com/health'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bpatch
Dbat
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bat' on Unix agents or wrong kubectl command.