简体   繁体   中英

How to get Jenkins build result in email notification

I have a jenkins job, and in that job, I have html format email notification. I need build status/result variable. I tried {ENV,var="BUILD_RESULT"} , but it doesn't work.

Could someone help me how to get build result information and print out in the email notification?

When using some of the pre-built templates I was using the following to get the state of the build and the last 250 lines of build-output:

<b style="font-size: 200%;">BUILD ${build.result}</b>

<!-- CONSOLE OUTPUT -->
<div class="content">
  <a href="${rooturl}${build.url}/console">
    <h1>Console Output</h1>
  </a>
  <table class="console">
    <j:forEach var="line" items="${build.getLog(250)}">
    <tr>
        <td><tt>${line}</tt></td>
    </tr>
    </j:forEach>
  </table>
  <br />
</div>

See the following places for more examples/templates:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM