my projects are in Perforce. What if I want to acces to one of those
properties which I know are available from looking at the jelly template,
for instance ${cppcheckResult.getDiff().getNumberNoCategorySeverity()} I
tried to echo that property but I get an error how could I access to it?
this is the jelly template I am using (I took it from SO)
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define">
<div class="content">
<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&after=5&states=new">${cppcheckResult.getDiff().getNumberTotal()}</a></B></td>
</tr>
</tfoot>
</table>
</j:if>
</j:if>
</html>
</div>
</j:jelly>
El viernes, 9 de abril de 2021 a las 14:27:16 UTC+2, [email protected]
escribió:
> Are your projects located in GitHub? Then it would be quite easy to report
> results automatically using the GitHub checks plugin. Email is quite
> old-school when it comes to build result reporting...
>
> Am 09.04.2021 um 13:58 schrieb jesus fernandez <[email protected]>:
>
> Thanks for asering. I have been checking the javadoc of the plugin
> https://javadoc.jenkins.io/plugin/email-ext/ but my java knowledge is
> super basic and I do not get to see where the methods available to Jenkins
> are. So I guess this is too advanced for me ATM
>
> El viernes, 9 de abril de 2021 a las 13:48:03 UTC+2, [email protected]
> escribió:
>
>> You need to read the code of the plugin. I.e., the model of the producer
>> plugin.
>>
>>
>> Am 09.04.2021 um 13:08 schrieb jesus fernandez <[email protected]>:
>>
>> I am learning Jenkins on my own and I am trying to learn about plugins. I
>> have a stage to send an email with the cppcheck results with a template I
>> found
>> https://stackoverflow.com/questions/13888338/sending-cppcheck-result-report-on-email-from-jenkins-using-email-ext-plugin
>>
>> the template instantiate the ```CppcheckBuildAction``` and access its
>> methods, what I would like to know if is possible to check what methods are
>> avaialable for that instance and if possible how / where I can see them.
>> Also how could I for example echo / println one of them. For instance in
>> the template provided in the link above it acces the total number of errors
>> with ${cppcheckResult.report.getNumberTotal()} but if I echo it I get an
>> error ```groovy.lang.MissingPropertyException: No such property:
>> cppcheckResult for class: groovy.lang.Binding```, this is what I tried
>> stage('Email') {
>> steps {
>> script{
>> publishCppcheck pattern:'cppcheck.xml'
>> emailext( subject: 'foo', to: '[email protected]', body: '${JELLY_SCRIPT,
>> template="custom"}')
>> }
>> echo "${cppcheckResult.report.getNumberTotal()}"
>> }
>> }
>> my final goal actually is to send the email just when the report find a
>> new error so I was thinking to save the total number of errors in an
>> external file and compare it with each build and if the number is bigger
>> send the email, is there any native / easier way to do this?
>>
>> --
>> 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/901e41a0-e2ec-466c-87a9-23d6082897e1n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/901e41a0-e2ec-466c-87a9-23d6082897e1n%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/48090815-12d1-4f8a-a15b-2d0c0185b830n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/jenkinsci-users/48090815-12d1-4f8a-a15b-2d0c0185b830n%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/e7ede103-a7e3-4a7a-8cf1-7beda07eaa06n%40googlegroups.com.