Failed Build Message in email
Hello,
We use TeamCity Services messages to fail a build, like so:
##teamcity[message text='Jus a sample for this post' errorDetails='Sample Error Details' status='Error']
Now, this will add the error (when it occurs) to the overview page of a completed build. However, the build errors are not included in the failure email.
We found this code from another thread and attempted to modify build_failed.ftl:
<#list build.buildLog.messages[1..] as message><#-- skipping the first message (it is a root node)-->
<#if message.status == "ERROR" || message.status == "FAILURE" >
${message.text}
</#if>
</#list>
<#if message.status == "ERROR" || message.status == "FAILURE" >
${message.text}
</#if>
</#list>
However, that didn't add the Build Errors to the failure email.
Any idea what we're doing wrong?
Thanks!
Please sign in to leave a comment.
Hello,
What TeamCity version are you using?
Since TeamCity 7.1 the correct way to fail a build is to report a build problem (as described here).
The build problem description will be added to the build status text and appear in the failure notification e-mail.
Thanks Victory. I'm using TeamCity 8.06. I see that the build status will be in the email, but I'd like the Build Error log in the email as well, for example. this is on my Overview page:
Build errors
I'd like that in my email.
Hello,
To have the list of all build log error messages in the notifiaction email you need to add the mentioned above FTL fragment to the following files under /webapps/ROOT/WEB-INF/plugins/email/server/email-notificator.jar/email_templates:
Please notice that using "build.buildLog.messages" may seriously affect the performance if the build has many messages in the build log.