I don't know if this is at all possible but still asking here to see if anyone has tried/thought about it.
I have a build running that when fails echo out html code as given below. I want to send this html as an email to all the recipients.
Currently when I use the simple email plugin then the whole console output is sent as an email which contains all these html tags (not at all readable). Then I installed the Email Ext plugin but I am not sure if the pre-send script can read my console output and send email. Has anyone tried it? Is it worth spending time on it or should I just modify the output to display formatted text?
This build is for internal tools and I can't create a .html file or send the link to the .html file as email because the path is behind firewall.
I don't know if this is supported at all but is it possible that the console output shows html output?
Thanks for the help!
<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
<table class="gridtable">
<thead>
<tr>
<th>Service Checked</th>
<th>Status</th>
<th>Response</th>
</tr>
</thead>
<tbody>
<tr>
<td>canary</td>
<td>Success</td>
<td>Please override the check() method</td>
</tr>
<tr>
<td style="color: red;"><strong>www.mysite.com</strong></td>
<td style="color: red;">Failure</td>
<td>Ping to https://www.mysite.com/canary?from=here FAILED</td>
</tr></tbody></table>
Enter the recipient email id in the 'E-mail Notification' box and select the checkbox next to the 'Send e-mail for every unstable build' option. Click the 'Add post-build action' drop-down and select the 'Editable Email Notification' value. Fill the 'Editable Email Notification' fields.
View the console output:From the Jenkins dashboard, click the job link name from the table. Click the build number in the Build History table in the sidebar. If you need to send the console output to Perforce Support, send it as plain text. Click View as plain text in the sidebar menu.
On Windows, Jenkins log files are stored as jenkins. out (console output logs) and jenkins. err (error logs) in the Jenkins home folder. Note: Jenkins logs may be stored in the Jenkins installation folder in Program Files on some Windows systems.
Email Ext plugin works just fine with HTML. It's up to your email client to parse HTML (but then again, most these days do).
The question is: how does your build output this HTML above? Does it output it to file? Does it display it in Console Output?
If the text is in console output, use:
<pre>${BUILD_LOG_EXCERPT, start="Regex-for-start", end="Regex-for-end"}</pre>
The <pre>
tags are to preserve spacing/formatting.
The start
and end
regular expressions are to identify the "starting line" from which to start displaying log, and the "ending line" at which to stop displaying log.
Note that the start
and end
lines themselves are excluded. So, in your build, put a header and footer lines just before and just after your html output, and use them here.
For reference, in the email-ext configuration, click the Content Reference question mark icon ?
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