Re: Jenkins EMail Reporting

2016-10-18 Thread jerome
I got some Jelly template working for this. First the jenkins file:

Make sure you collect your unit test results:
step([$class: 'JUnitResultArchiver', testResults: 'TestResult/*.xml']);


Then send the email:
emailext body: '${JELLY_SCRIPT,template="
${env.JENKINS_HOME}/email-templates/myTemplateFile.jelly"}', subject: 
email_subject, to: 'c...@bodycad.com', replyTo: 'jenk...@bodycad.com', 
mimeType: 'text/html'

Take car under Windows the '\\' is not supported into the template path and 
you need to flip them:
'${JELLY_SCRIPT,template="' + "${env.JENKINS_HOME}/email-templates/
myTemplateFile.jelly".replaceAll('[]','/') + '"}'

Here's the Jelly template that should be saved into Jenkins home folder 
under email-templates (I removed any style here to simplify the whole thing 
and removed other parts), you can modify the html to your code:



]>





 
 Unit Tests
 
 
 
 
 Tests Root Name
 ${packageResult.getName()}
 
 
 Tests Counts
 
${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}

 
 
 Tests Pass
 ${packageResult.getPassCount()}
 
 
 Tests Skip
 ${packageResult.getSkipCount()}
 
 
 Tests Fail
 ${packageResult.getFailCount()}
 
 
 
 Failed: ${failed_test.getFullName()} 
 
 
  
 







-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/35df7488-1e47-42f6-ae3b-9f4e88aa1242%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins EMail Reporting

2016-09-21 Thread jerome
I known my answer will not be received well by most, but that was the 
fastest way I could find, I did a Python script with XunitParser module 
made that a breeze (I can even test it better or use other tools to run 
them).

https://pypi.python.org/pypi/xunitparser

Just write to a temporary file using the tmp() folder and then sh or bat 
the python script and give the output file as argument, output into the 
wanted format and just read the file into Jenkins pipeline.

All those little Python script have save me hours so far compare to messing 
around into the Jenkins "cripple" Groovy. Just doing a iteration on list 
doesn't work as it is suppose too into that Groovy implementation! @NonCPS 
is a bag of crab so far for me (same function does or doesn't return the 
same result with or without the @NonCPS, some function I had written where 
working until some update where I had to add the @NonCPS by updating 
Jenkins). Having to allow all the operations (map hash, file 
getAbsolutePath, operator string to string, ...) but can launch a shell or 
batch operation that can access whatever folder.

May sound harsh on Jenkins, but every new commer have question on how to do 
simple stuff (this include myself, I'm no different here! the struggle is 
real, especially for people who did not touch any groovy before and realize 
they don't really have a full features Groovy engine to play with) because 
we can't rely on Groovy way of doing those thing, because those way doesn't 
work most of the time into that implementation or need to be tweak a lots 
to make them working. Many of those questions are left without answer since 
nobody really know how to do them properly into that script engine.


-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/124ae7d3-2a6e-431e-b8e0-d682dcf64303%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins EMail Reporting

2016-09-21 Thread Bubunia Patra
Hi all,

I am looking for some way to email the test results from the Jenkins to the 
recipients in a nice format After my test executes the console logs are 
generated in jenkins. I have installed the extended E-mail Plugin for email 
and configured the smtp server. The test also generates the JUNIT.xml which 
contains Pass/Fail results but doesn't contain the failure reason which 
needs to be retrieved from the console logs.

The Email-Plugin emails the results but it is either truncated or not the 
format I want it. Is there any other plugin I need to use which will 
retrieve the failure reason from the console log and email the results 
similar to below:

I want Something like the below in a table  :

TestCase Name |  Status |  Link |  Failure Reason
==

Is there a better way or example for Email reporting in Jenkins to suffice 
my requirement? If so what are the other tools/plugins I should install and 
the way I can achieve this? I saw the customise email reporting can be 
achieved through jelly script. Can someone provide me an example jelly 
script for email reporting ?

https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin#Email-extplugin-Advancedconfiguration

I will appreciate if some one can help me in this regard?

Regards
Pradeep

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9a902866-2bc9-44fe-86fa-5e63d5852552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.