How to initiate email based on a specific condition for a successful build in Jenkins

Whenever a certain condition is met in the Execute shell of the Post-build step to build successfully , I want to call send email. The problem is that even if the condition is not met, the assembly is considered successful.

What I'm trying to implement:

if [condition == true]; then
  <do some action1>
  exit 0; //This success code should trigger email
else
  <do different action2>
  exit 0; //This success code should not trigger email
fi

The exit codes are 0, since both of the above actions are valid and this is successful . How do I send a message to Success based on some criteria in Jenkins?

+1
source share
1 answer

, Email-ext. .

: Script - " , , post post script, , . , post-build script , After Build .

+3

All Articles