Shah
Shah

Reputation: 553

How to send email content based on pass / fail jobs in jenkins

I would like to know if i can change context of email based on pass / fail condition in jenkins.

i am using editable email notification plugin in which i don't see any option to change context of email if build fails. there are trigger option available but that is for to whom we want to notify based on job's condition.

What i want to do is if build pass i want to send html link ( which is i have set in Default Content option ) but i don't want to send that when it fails as there will be no report available on that link in fail scenario. So in this case i am fine instead of sending hyper link if i can send console log

Upvotes: 0

Views: 2227

Answers (2)

mainframer
mainframer

Reputation: 22069

I think you've missed the advanced button for each trigger.

  • Fails

    Advanced Settings --> Add Trigger --> Failure Any --> Advanced ---> Content,
    and then put the Failure content here.

  • Success

    Advanced Settings --> Add Trigger --> Success --> Advanced ---> Content,
    and then put the Success content here.

Upvotes: 3

Harshavardhan Konakanchi
Harshavardhan Konakanchi

Reputation: 4294

You can use DEFAULT_PRESEND_SCRIPT from the email extension plugin to cancel the email and modify the content of email

Upvotes: 0

Related Questions