Jenkins email ext jelly script include file contents

心不动则不痛 提交于 2019-12-23 20:33:15

问题


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


回答1:


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}



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/17371665/jenkins-email-ext-jelly-script-include-file-contents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!