Show changes with files in TeamCity 5.1 notification
I would like to include a list of changed files in the TeamCity 5.1 email notification that is sent to my team after a successful or unsuccessful build. I have looked at the documentation on Configuring Notifications in TeamCity 5.1 and I have looked at the .ftl template files found in the config \ _notifications \ email folder, but I could not find a list of available template variables or alternative sample templates. I was able to include the list of changed files in previous versions of TeamCity (I think it was called "Changes to Files"), but I have nothing to believe in TeamCity 5.1. Any ideas?
a source to share
I managed to get this to work in TeamCity 6, so I don't know if it works on 5.1 or not, but here's what I did based on reading an example from the help docs.
Edited common.ftl to add
<#macro build_changes_files 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>.
<br>
<br>
<b>Files:</b>
<br>
<ul>
<#list mod.getFilteredChanges(buildType) as change>
<li>${change.getRelativeFileName()} - ${change.getChangeTypeName()}
</li>
</#list>
</ul>
</div>
</#list>
</#if>
</div>
</#macro>
Then in * build_started.ftl * (or any suitable FTL file) where I would like to list the modified files, I put:
<@common.build_changes_files var.changesBean/>
a source to share