InterviewSolution
| 1. |
Mention some post condition pipelines options that you used in Jenkinsfile? |
|
Answer» We can mention some test conditions to run post the completion of stages in a PIPELINE. Code snippet post { ALWAYS { echo “This block runs always !!!” } SUCCESS { echo “This block runs when the stages has a success status” } unstable { echo “This block is run when the stages abort with an unstable status” } }Here are the post conditions reserved for jenkinsfile:
Run the steps in the post section REGARDLESS of the completion status of the Pipeline’s or stage’s run.
Only run the steps in post if the current Pipeline’s or stage’s run has an "unstable" status, usually caused by test FAILURES, code violations, etc.
Only run the steps in post if the current Pipeline’s or stage’s run has an “aborted” status.
Only run the steps in post if the current Pipeline’s or stage’s run has a "success" status.
Only run the steps in post if the current Pipeline’s or stage’s run has a "failed" status.
Only run the steps in post if the current Pipeline’s or stage’s run has a different completion status from its previous run.
Run the steps in this post condition after every other post condition has been evaluated, regardless of the Pipeline or stage’s status. |
|