0
0
Jenkinsdevops~10 mins

Post section (success, failure, always) 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 run a step only when the build succeeds.

Jenkins
post {
  [1] {
    echo 'Build succeeded!'
  }
}
Drag options to blanks, or click blank then click option'
Afailure
Bsuccess
Calways
Dunstable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'failure' instead of 'success'
Using 'always' when only success is needed
2fill in blank
medium

Complete the code to run a step only when the build fails.

Jenkins
post {
  [1] {
    echo 'Build failed!'
  }
}
Drag options to blanks, or click blank then click option'
Afailure
Bunstable
Calways
Dsuccess
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'success' instead of 'failure'
Using 'always' when only failure is needed
3fill in blank
hard

Fix the error in the post section to run a step regardless of build result.

Jenkins
post {
  [1] {
    echo 'This runs no matter what.'
  }
}
Drag options to blanks, or click blank then click option'
Aunstable
Bfailure
Csuccess
Dalways
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'success' or 'failure' instead of 'always'
4fill in blank
hard

Fill both blanks to run steps on success and failure respectively.

Jenkins
post {
  [1] {
    echo 'Build succeeded!'
  }
  [2] {
    echo 'Build failed!'
  }
}
Drag options to blanks, or click blank then click option'
Asuccess
Bfailure
Calways
Dunstable
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping success and failure blocks
Using 'always' instead of specific blocks
5fill in blank
hard

Fill all three blanks to run steps on success, failure, and always.

Jenkins
post {
  [1] {
    echo 'Success block'
  }
  [2] {
    echo 'Failure block'
  }
  [3] {
    echo 'Always block'
  }
}
Drag options to blanks, or click blank then click option'
Asuccess
Bfailure
Calways
Dunstable
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of blocks
Using 'unstable' which is not a post condition