Rnet
Rnet

Reputation: 5040

Jenkins email ext jelly script include file contents

Can I display the contents of another file in my jelly script output?

Upvotes: 3

Views: 4793

Answers (3)

Stéphane Bruckert
Stéphane Bruckert

Reputation: 22903

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}

Upvotes: 1

Josh Unger
Josh Unger

Reputation: 7163

Look at util:loadText which is a "tag which loads text from a file or URI into a Jelly variable."

<u:loadText var="contents" file="${filename}"/>
${contents}

Haven't used it inside of Jenkins before... let us know if it works.

Upvotes: 0

gareth_bowles
gareth_bowles

Reputation: 21130

Yes, you can use the ${FILE, path} token to include the contents of a file (path is relative to your workspace directory).

This info is taken from the Content Token Reference in the email-ext part of your job configuration. Click the question mark on the right to get the full list of tokens.

Upvotes: 1

Related Questions