In a Jenkins pipeline using blue-green deployment, what is the main advantage of the rollback strategy?
Think about how blue-green deployment handles traffic between two environments.
Blue-green deployment keeps two environments ready. Rollback means switching traffic back instantly to the stable one, avoiding downtime.
What is the output of this Jenkins pipeline snippet when rollback is triggered?
pipeline {
agent any
stages {
stage('Deploy') {
steps {
script {
def success = false
if (!success) {
error('Deployment failed, triggering rollback')
}
}
}
}
stage('Rollback') {
steps {
echo 'Rollback started'
}
}
}
post {
failure {
echo 'Rollback started'
}
}
}Look at how the error and post failure blocks behave in Jenkins pipelines.
The error in the Deploy stage triggers failure. The post failure block and Rollback stage both echo 'Rollback started'.
Which Jenkins pipeline snippet correctly implements a canary deployment rollback by checking a health status and reverting if unhealthy?
Remember that sh returns 0 on success and non-zero on failure.
Option D correctly checks if the health check returns 0 (success). If not healthy, it triggers rollback by error.
A Jenkins pipeline has a rollback stage defined after deployment. The rollback stage does not run even when deployment fails. What is the most likely cause?
Think about how Jenkins decides to run post or subsequent stages on failure.
If deployment errors are caught and not rethrown, Jenkins considers the stage successful and skips rollback.
In a Jenkins multibranch pipeline, which workflow best ensures automatic rollback on failure while minimizing downtime and resource usage?
Consider automation, downtime, and resource efficiency in your answer.
Option A automates rollback only on failure, minimizing downtime and resource use by cleaning up failed deployments immediately.