Search code examples
jenkinsemail-extjenkins-cli

Customizing email ext plugin in jenkins


I was trying to create a custom message for build fails, i wanted to add the name of the user whose commit break the build, the commit message and a brief summary of the error. Can i write this in the 'Content' section in the configuration page or should i write a separate template file? I am using svn


Solution

  • I have been using this email ext plugin for a while. Here are an example for those who are new to this jenkins plugin, you can see this as a best practice and do some little modification as you need,enjoy it.

    Content Type: HTML
    Default Subject: [${BUILD_STATUS}]${JOB_NAME} Build #${BUILD_NUMBER} Total ${TEST_COUNTS,var="total"}/Fail ${TEST_COUNTS,var="fail"}/Skip ${TEST_COUNTS,var="skip"}

    Default Content:

    <b>Job URL</b><br/>
    <a href="$${BUILD_URL}">${BUILD_URL}</a><br/>
    <br/>
    <b>Branch</b><br/>
    ${GIT_BRANCH}<br/>
    <br/>
    <b>Changes</b><br/>
    ${CHANGES,showPaths=true,format="[%d]-[%a] %m<br/>"}<br/>
    <br/>
    <b>Build Cause</b><br/>
    ${CAUSE}<br/>
    <br/>
    <b>Test Results</b><br/>
    ${FILE,path="rspec_results.html"}<br/>
    <br/>
    <b>Code Coverage</b><br/>
    ${FILE,path="coverage/rcov/index.html"}
    <br/>
    ${FILE,path="tmp/metric_fu/output/stats.html"}
    

    enter image description here

    Then The ${CAUSE} variable will like this: