2
votes

Using Jenkins and email-ext, I have copied the "html" template and made it look the way I want for our build mail.

What I'd like to do now is get some custom metrics in the build mail. Specifically, our build jobs call a number of PHP scripts that perform work. One of these scripts creates a bunch of files in a directory. I'd like to have our build mail have an output line like:

The super cool script created 8 files for your enjoyment.

The PHP script knows it created 8 files, of course. How could that script get that number in a place where Jelly could know it and output it? Is there a way to have Jenkins store such things and make them available to the Jelly template?

2

2 Answers

0
votes

Use the EnvInject Plugin https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Set the Enviroment variable in your PHP script

Output the Environment Variable in your Email-Ext

0
votes

If the files are created in a specific directory - so counting the number of files in a folder is good enough -, you could try something like this in your jelly template (note: I didn't test it):

<j:set var="filesCreated" value="${build.getWorkspace().child('path/to/result/dir').list().size()}"/>

The super cool script created ${filesCreated} files for your enjoyment.