Search code examples
jenkinsjellyemail-ext

How to get custom metrics into jelly for email-ext?


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?


Solution

  • 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