I'm almost ready to release a new version that should allow access to importing everything correctly in groovy templates.
Sent from my Windows Phone From: Ullrich Hafner Sent: 6/5/2012 1:59 AM To: jenkinsci-dev@googlegroups.com Cc: Michael Polinovskiy Subject: Re: Email with pmd | checkstyle Hope you don't mind that I'm using the dev list as recipient, so others can participate... On 06/04/2012 07:48 PM, Michael Polinovskiy wrote: > Hi Ulli, > > looking at jelly templates you've provided, I have some novice questions > you probably can answer on the fly without spending too much of your > valuable time. > > I'd like to access the Clover plug-in in a similar way as <j:set > var="fb" > value="${it.getAction('hudson.plugins.findbugs.FindBugsResultAction')}" > /> but I cannot find an entry point. What I've found so far by reverse > engineering is following: > clover plug-in renders the number of tests passed into its html report > by using Isn't the action a hudson.plugins.clover.CloverBuildAction? So you can access the action of a build with: <j:set var="clover" value="${it.getAction('hudson.plugins.clover.CloverBuildAction')}" /> >From this class you can use all public methods... And you can also navigate to all public associations. I.e. you can use something like ${clover.result} to obtain a reference to the instance of ProjectCoverage, and so on. Just have a look on the public methods of ProjectCoverage... > #set ($projectMetrics = ${renderUtil.metricsFor($projectInfo)}) > $projectMetrics.numTestPasses > $projectMetrics.numTests > where renderUtil is an instance of HtmlRenderingSupport and > projectMetrics is an instance of BlockMetrics, which has a public method > getNumTestPasses(). > So it looks like they are using some proprietary methods to access the > needed data. Can I integrate the same somehow into the jelly template? > > The way JUnit results are integrated into jelly template is also not > very clear to me. There is following code there: > <j:forEach var="junitResult" items="${it.JUnitTestResult}"> Ok, I see why this is confusing (this is a short cut in the email-ext plug-in). it.JUnitTestResult means: call the following method on it ('it' is an instance of ScriptContentBuildWrapper in email-ext). The return type is a TestResult (which is part of core). This is the method that will be called: public List<TestResult> getJUnitTestResult() { } This method knows hot to return the TestResult from the build. So in your case it is much simpler, use the code above to obtain the CloverBuildAction. Then you can navigate the object model... > <j:forEach var="packageResult" > items="${junitResult.getChildren()}"> > <tr> > <td class="border"> > <tt>${packageResult.getName()}</tt> > </td> > <td class="border > test_failed">${packageResult.getFailCount()}</td> > <td class="border > test_passed">${packageResult.getPassCount()}</td> > <td class="border > test_skipped">${packageResult.getSkipCount()}</td> > <td class="border"> > > <b>${packageResult.getPassCount()+packageResult.getFailCount()+packageRe > sult.getSkipCount()} > </b> > </td> > </tr> > <j:forEach var="failed_test" > items="${packageResult.getFailedTests()}"> > <tr> > <td class="test_failed" colspan="5"> > <tt>${failed_test.getFullName()}</tt> > </td> > </tr> > </j:forEach> > </j:forEach> > </j:forEach> > > I was not able to find the class JUnitTestResult.java in any plug-in. Am > I misunderstanding something? I'd like to have the total fail/pass count > and not per package... > > Sorry if my questions are ridiculous, but I have absolutely no > experience with Jenkins object model, plug-in architecture or jelly. I'm > now totally confused about how the things are working and would > appreciate any hints or help from your side. > In this beginning this looks quite complex. It would be simpler if we would have a UI for the navigation of the object model. So what you basically need: 1.) the anchor point that you can get from the root instance ${it} using the method getAction(String qualifiedNameOfAction) using the expression ${it.action('qualifiedNameOfAction')} 2.) The return value of this call is the next object which is of the type 'qualifiedNameOfAction'. Open this type in your IDE: you can now call all public methods on this instance. Typically the result is available in a method getResult(), so you can use the ${action.result} to access that object (where action is the result of the previous call it.action('qualifiedNameOfAction'). 3.) Inspect all public methods on result, and so on... Hope this makes thing more clear :-) Ulli > > Thanks and Regards, > Michael > > -----Original Message----- > From: Ullrich Hafner [mailto:ullrich.haf...@gmail.com] > Sent: Thursday, May 31, 2012 3:28 PM > To: jenkinsci-us...@googlegroups.com > Cc: Michael Polinovskiy > Subject: Re: Email with pmd | checkstyle > > Well, I don't use these tools. But it is quite easy to clone the > email-ext plug-in and create a pull request:-) Are you volunteering? > > Ulli > > > On 05/31/2012 12:39 PM, Michael Polinovskiy wrote: >> Hi Ulli, >> >> great job, thanks! >> Wouldn't it be possible somehow to add a template for Clover and Robot >> Framework? >> >> Regards, >> Michael >> >> -----Original Message----- >> From: jenkinsci-us...@googlegroups.com >> [mailto:jenkinsci-us...@googlegroups.com] On Behalf Of Ullrich Hafner >> Sent: Tuesday, May 22, 2012 12:28 PM >> To: jenkinsci-us...@googlegroups.com >> Subject: Re: Email with pmd | checkstyle >> >> On 05/22/2012 11:49 AM, arjun tr wrote: >>> I was trying to include short summary of cobertura, pmd, checkstyle, >>> findbugs reports in emails. >>> I was able to get configurations for cobertura but not for others >>> with jelly. >>> Is there any place which details on the other plugin configurations >>> and class, method definitions in either jelly or groovy?? >> I added a new template in the latest release of the email-ext plug-in: >> https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/res >> ou rces/hudson/plugins/emailext/templates/static-analysis.jelly >> >> It simply shows the total number of warnings for each of the analysis >> tools. >> >> Ulli >> >>