0
0
Jenkinsdevops~10 mins

Feedback loop importance 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 a Jenkins pipeline stage that sends feedback after build.

Jenkins
stage('Feedback') {
    steps {
        [1] 'echo "Build completed, sending feedback"'
    }
}
Drag options to blanks, or click blank then click option'
Acheckout
Binput
CarchiveArtifacts
Dsh
Attempts:
3 left
💡 Hint
Common Mistakes
Using input instead of sh for running commands.
2fill in blank
medium

Complete the code to trigger a Jenkins pipeline stage only if the build fails, to send failure feedback.

Jenkins
stage('Failure Feedback') {
    when {
        [1] 'FAILURE'
    }
    steps {
        sh 'echo "Build failed, notifying team"'
    }
}
Drag options to blanks, or click blank then click option'
Astatus
Bexpression
Cbranch
Denvironment
Attempts:
3 left
💡 Hint
Common Mistakes
Using branch or environment which do not check build status.
3fill in blank
hard

Fix the error in the Jenkins pipeline snippet to correctly send feedback after tests.

Jenkins
stage('Test Feedback') {
    steps {
        [1] 'echo "Tests passed, sending feedback"'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bbat
Cinput
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using bat on Unix agents causes errors.
4fill in blank
hard

Fill both blanks to create a post-build action that always sends feedback regardless of build result.

Jenkins
post {
    [1] {
        [2] 'echo "Build finished, sending feedback"'
    }
}
Drag options to blanks, or click blank then click option'
Aalways
Bsh
Csuccess
Dfailure
Attempts:
3 left
💡 Hint
Common Mistakes
Using success or failure which run conditionally.
5fill in blank
hard

Fill all three blanks to define a pipeline that sends feedback only if tests pass and code is on the main branch.

Jenkins
pipeline {
    agent any
    stages {
        stage('Test') {
            steps {
                sh 'run tests'
            }
        }
        stage('Feedback') {
            when {
                [1] 'SUCCESS'
                [2] 'main'
            }
            steps {
                [3] 'echo "Tests passed on main, sending feedback"'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Astatus
Bbranch
Csh
Denvironment
Attempts:
3 left
💡 Hint
Common Mistakes
Using environment instead of branch for branch condition.