Hi Mick,

FWIW, I am not familiar with jelly scripts, but as I posted earlier, I am using 
the "Editable Email Notification" option in "Post Build Actions".  In one of my 
jobs, the body of the email to be sent in the Job Configuration is:

${FILE,path="email.txt"}

That's why I think you can literally send anything you want.  Whether you use 
Jelly or not, get your build to produce a text file with the results exactly as 
you want it, then send it.

HTH,
-Alex

On 4/11/20, 9:42 AM, "Mick Semb Wever" <m...@apache.org> wrote:

    Thanks Matt and Alex,
    
    
    > To elaborate further, if you look through the global variables available,
    > you should be able to obtain all the info you’d use in a Jelly template
    > without the maintenance hassle.
    
    
    A bit of background to the problem…
    
    The Cassandra community wants a permanent record of test results. This 
helps bisect and blame regressions. Jenkins itself is not suitable as reliable 
storage of such history, while a mailing list is. The Cassandra pipeline has 
over 18 thousand tests, and we looking at adding more. 
    
    Taking a closer look and the `Tokens` available there is more than I 
realised, thanks, but I still doubt that I will be able to replicate the jelly 
code that's below. 
    
    What I did discover in the Tokens documentation though was a reference to 
the Config File Provider Plugin, which suggests the following is possible: 
`${JELLY_SCRIPT, template="managed:cassandra-text.jelly"}` 
    
    
    <!-- cassandra-text.jelly -->
    <?jelly escape-by-default='true'?>
    <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" 
xmlns:d="jelly:define">
    
    BUILD ${build.result}
    
    Build URL: ${rooturl}${build.url}
    Project: ${project.name}
    Date of build: ${it.timestampString}
    Build duration: ${build.durationString}
    
    <!-- JUNIT RESULTS -->
    <j:set var="junitResultList" value="${it.JUnitTestResult}" />
    <j:if test="${junitResultList.isEmpty()!=true}">
    
    FAILURES
        <j:forEach var="junitResult" items="${it.JUnitTestResult}">
                <j:forEach var="packageResult" 
items="${junitResult.getChildren()}">
                <j:forEach var="failed_test" 
items="${packageResult.getFailedTests()}">
        Failed: ${failed_test.getFullName()}
                </j:forEach>
                </j:forEach>
        </j:forEach>
    
    
    RESULTS
        <j:forEach var="junitResult" items="${it.JUnitTestResult}">
                <j:forEach var="packageResult" 
items="${junitResult.getChildren()}">
    Name: ${packageResult.getName()} Failed: ${packageResult.getFailCount()} 
test(s), Passed: ${packageResult.getPassCount()} test(s), Skipped: 
${packageResult.getSkipCount()} test(s), Total: 
${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}
 test(s)
                <j:forEach var="failed_test" 
items="${packageResult.getFailedTests()}">
        Failed: ${failed_test.getFullName()}
                </j:forEach>
                </j:forEach> 
        </j:forEach>    
    </j:if>
    </j:jelly>
    

Reply via email to