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:

  • always:

Run the steps in the post section REGARDLESS of the completion status of the Pipeline’s or stage’s run.

  • unstable:

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.

  • aborted:

Only run the steps in post if the current Pipeline’s or stage’s run has an “aborted” status.

  • success:

Only run the steps in post if the current Pipeline’s or stage’s run has a "success" status.

  • failure:

Only run the steps in post if the current Pipeline’s or stage’s run has a "failed" status.

  • changed:

Only run the steps in post if the current Pipeline’s or stage’s run has a different completion status from its previous run.

  • cleanup:

Run the steps in this post condition after every other post condition has been evaluated, regardless of the Pipeline or stage’s status.



Discussion

No Comment Found