I'm trying to use email notifications in my Jenkins pipeline. What I want is to send a notification on failed build and a notification on fixed build. The first is really easy with a try/catch
or catchError
but I haven't found a solution for the latter.
Is it possible to send a notification for fixed builds in a Jenkins Pipeline ?
You can use Jenkins Class Mailer to accomplish what you want by calling Mailer:
in your
try/catch/finally
clause infinally
. Mailer sends emails on fixed builds(by itself):Another way is to manually check the status of the previous build and the current build and if they satisfy your requirements, then you send the email. You can do that following this resolution.