I am new to Jenkins and I'm trying to attach a HTML file to the body of an email that is created on one of my slaves. I'm using the email-ext plugin but I'm not sure how to attach the HTML to the body - i.e. where does the HTML file have to be located, code to attach it?
Click the 'Available' tab present at the top of the 'Manage Plugin' page. Type 'Notification' in the 'Filter' field displayed at the top-right side of the 'Manage Plugin' page. Click the checkbox next to the 'Email-ext plugin' option and 'Email-ext Template Plugin' option. Click the 'Install without restart' button.
I'm pretty sure someone here can come up with a more fancy solution, but I've seen (not been able to get it to work as I would like :-( ) that this can be done using a groovy template.
It should be as simple as placing the following snippet inside the body of your e-mail content:${SCRIPT, template="groovy-html.template"}
And then modifying the content of the groovy-html.template file to suit your needs. I'd recommend starting out with the template already present with your installation and then modifying it as you go along.
You might also need to include the groovy plugin but I'm not sure about that.
I would suggest also just plugging your HTML code straight into the email trigger section.
heres an example of what i'm using:
<html>
<body>
Hi there $DOTCI_PUSHER
<br>
<br>
You are receiving this email because Build $BUILD_NUMBER has been set to: $BUILD_STATUS
<br>
<br>
<u>Execution Results :</u><br>
Avg : ${BUILD_LOG_REGEX, regex="Avg:", showTruncatedLines=false}<br>
Min : ${BUILD_LOG_REGEX, regex="Min:", showTruncatedLines=false}<br>
Max : ${BUILD_LOG_REGEX, regex="Max:", showTruncatedLines=false}<br>
Errors : ${BUILD_LOG_REGEX, regex="Err:", showTruncatedLines=false}<br>
<br>
Build URL : $BUILD_URL
<br>
<br>
Console Output: <br>
<pre>${BUILD_LOG, maxLines=20}</pre>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With