TeamCity 5.1 Email template
Hi,
I'm going to begin use TeamCity for our projects. It has a lot of very useful stuff.
But now I've faced with notification problem.
I want that every letter contains information about last 10 commit to svn.
I found here http://confluence.jetbrains.net/display/TCD5/Customizing+Notifications+(in+TeamCity+5.1) that I can use ${buildServer.getVcsHistory()} for my porposes.
But unfrotunately I get following error:
[2011-02-07 14:57:27,180] WARN - .notification.FreeMarkerHelper - Expression buildServer is undefined on line 27, column 3 in email/build_successful.ftl.
All others objects like build, buildType are available.
Could someone help me?
Please sign in to leave a comment.
So I found solution for me. Now the notification email contains info about changed files:
I've just added new macro "build_all_changes" to common.ftl. And then insert reference to build_succesful.ftl and build_failed.ftl: <@common.build_all_changes var.changesBean />
Probably it could help someone else ;)
<#macro build_all_changes bean>
<#-- @ftlvariable name="buildType" type="jetbrains.buildServer.serverSide.SBuildType" -->
<#-- @ftlvariable name="bean" type="jetbrains.buildServer.notification.impl.ChangesBean" -->
<#-- @ftlvariable name="webLinks" type="jetbrains.buildServer.serverSide.WebLinks" -->
<div>
<#assign modNum=bean.modificationsNumber/>
<#if (modNum > 0)>
<hr>
<div>
<#assign changesLink><a href='${webLinks.getViewChangesUrl(bean.build)}'>${modNum} change<@plural modNum/></a></#assign>
Changes included (${changesLink})<#if bean.changesClipped>,
only ${bean.modifications?size} are shown</#if>.
</div>
<#list bean.modifications as mod>
<#assign pers><#if mod.personal>(personal build)</#if></#assign>
<#assign description=mod.description/>
<#if description?length == 0><#assign description='<no comment>'/></#if>
<div>
<#assign modLink><a href='${webLinks.getChangeFilesUrl(mod.id, mod.personal)}'>${mod.changes?size} file<@plural mod.changes?size/></a></#assign>
Change ${mod.displayVersion} ${pers} by ${mod.userName} (${modLink}):
<i>${description?trim}</i>.
Files:
<br/>
<#list mod.getFilteredChanges(buildType) as change>
${change.getRelativeFileName()} - ${change.getChangeTypeName()}
<br/>
</#list>
</div>
</#list>
</#if>
</div>
FYI, I posted on a similar question, ie how to increase the number from 10 changes in the email, and referenced this post, here;
http://stackoverflow.com/questions/10515718/teamcity-email-only-10-changes-are-shown-how-to-show-more-changes/12940604#12940604
Also thank you for your googleable post, possibly that is how I originally found how to add the changes!