Jenkin email-ext: How do I include the contents of an html file in my jelly script output?

485 Views Asked by At

My Jenkins build produces a HTML file. I want to include this file in the HTML output of my jelly script via the Jenkins email-ext plugin.

I saw this answer in an old post but, as one person wrote, it only print the file path and not the content

If the file is included in the workspace of the job, declare your variable such as:

<j:set var="fileContent" value="${build.getWorkspace().child("results.html")}"/>

And call it this way:

${fileContent}
1

There are 1 best solutions below

1
M.Klein On

Perhaps I found my own answer. This works for me:

<j:set var="fileContent" value="${build.getWorkspace().child('polyspace').child('ps_results_summary.html').readToString()}"/>
${fileContent}

Without the .readToString() method I only got the file path returned.