Hi All

I have tried this multiple times didn't work. So I ended up writing
python/shell script which will generate the html format I wanted and use
email plugin to send that html file. It's works like a charm and we can
added error capturing/many more items to email if we use python script to
generate html fot us.

On Thu, 8 Apr, 2021, 4:37 pm jesus fernandez, <[email protected]>
wrote:

> I have also tried with some other templates with the same result, if I
> remove the ```mimeType: 'text/html'``` I do not get an error but I get a
> blank email in both cases
>
> El jueves, 8 de abril de 2021 a las 13:02:11 UTC+2, jesus fernandez
> escribió:
>
>> I want to send the cppcheck report through email but I had never used the
>> email ext plugin before, so I found this
>> https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
>> with a nice jelly template to do so, I have also followed the steps in the
>> documentation, to send my own templates in a pipeline job, I have created
>> my template with a .jelly extension and set it into my
>> ```$JENKINS_HOME\email-templates``` although the email-templates folder did
>> not exist, so I am not sure if it should be created beforehand just by
>> installing the plugin or what I am missing. This is my stage
>> ```
>>         stage('Mail cppcheck report') {
>>             steps{
>>                 script{
>>                     def mailRecipients = "[email protected]"
>>                     def jobName = currentBuild.fullDisplayName
>>
>>                     emailext body: '''${JELLY_SCRIPT,
>> template="custom"}''',
>>                     subject: "[Jenkins] ${jobName}",
>>                     to: "${mailRecipients}"
>>                 }
>>             }
>>         }
>> ```
>>
>> And this is the template I want to use but I keep getting the following
>> error ``` JellyException: Could not parse Jelly script : null```
>>
>> ```
>> <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
>> xmlns:d="jelly:define">
>>   <html>
>>     <j:set var="cppcheckAction"
>> value="${it.getAction('org.jenkinsci.plugins.cppcheck.CppcheckBuildAction')}"
>> />
>>       <j:if test="${cppcheckAction!=null}">
>>     <j:set var="cppcheckResult" value="${cppcheckAction.getResult()}" />
>>     <j:if test="${cppcheckResult!=null}">
>>       <h2>Summary</h2>
>>         <style type="text/css">
>>     #cppcheckStatistics { width: auto; }
>>     #cppcheckStatistics .number { text-align: right; }
>>         </style>
>>         <table class="pane sortable" id="cppcheckStatistics">
>>           <thead>
>>             <tr>
>>               <td class="pane-header">Severity</td>
>>               <td class="pane-header">Count</td>
>>               <td class="pane-header">Delta</td>
>>             </tr>
>>           </thead>
>>           <tbody>
>>             <tr>
>>               <td class="pane">Error</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberErrorSeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberErrorSeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">Warning</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberWarningSeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberWarningSeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">Style</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberStyleSeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberStyleSeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">Performance</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberPerformanceSeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberPerformanceSeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">Portability</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberPortabilitySeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberPortabilitySeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">Information</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberInformationSeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberInformationSeverity()}</td>
>>             </tr>
>>             <tr>
>>               <td class="pane">No category</td>
>>               <td class="pane
>> number">${cppcheckResult.statistics.getNumberNoCategorySeverity()}</td>
>>               <td class="pane
>> number">${cppcheckResult.getDiff().getNumberNoCategorySeverity()}</td>
>>             </tr>
>>           </tbody>
>>           <tfoot>
>>             <tr class="sortbottom">
>>               <td class="pane-header">Total</td>
>>               <td class="pane-header number"><B><a
>> href="${rooturl}${build.url}cppcheckResult">${cppcheckResult.report.getNumberTotal()}</a></B></td>
>>               <td class="pane-header number"><B><a
>> href="${rooturl}${build.url}cppcheckResult/source.all/?before=5&amp;after=5&amp;states=new">${cppcheckResult.getDiff().getNumberTotal()}</a></B></td>
>>             </tr>
>>           </tfoot>
>>         </table>
>>       </j:if>
>>     </j:if>
>>   </html>
>> </j:jelly>
>> ```
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/43b0776a-7903-46fb-96b6-ef1b73db27can%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/43b0776a-7903-46fb-96b6-ef1b73db27can%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CA%2B6q8-7rtJZLT4Zh%2Bg%3D8s0Q%3D%2BY%2Be_VrPTAzupyL%3DxYOSv%3DUtdg%40mail.gmail.com.

Reply via email to