Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Jenkins, How do I send emails only when the branch failed is the master branch?

Tags:

git

jenkins

I want to write a script in pre-send script (from Editable-Email Notification plugin) to send the email (set the cancel flag to true) ONLY when the branch failed is a master branch (as in have master in the name of the branch). How do I do this?

like image 268
theChosenOne Avatar asked Nov 01 '22 08:11

theChosenOne


1 Answers

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

your git plugin holds a env varible or you can make a env variable with branch name. then use the above solution to drop mail.

GIT Plugin provides you the env variable

GIT_BRANCH - Name of the remote repository (defaults to origin), followed by name of the branch currently being used, e.g. "origin/master" or "origin/foo"

like image 68
DevD Avatar answered Nov 11 '22 07:11

DevD