Mention some post condition pipelines options that you used in Jenkinsfile?

Devops Devops in Devops . 3 years ago

  3   0   0   0   0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

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.

Posted on 31 May 2022, this text provides information on Devops related to Devops in Devops. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Tuteehub forum answer Answers

Post Answer

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.