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 which is sent out to my team after a successful or failed build. I have reviewed the Customizing Notifications in Te开发者_高级运维amCity 5.1 documentation and I have looked at the .ftl template files found within the config\_notifications\email folder, but I haven't found a list of available template variables or alternate template samples. I was able to include a list of changed files in prior versions of TeamCity (I think it was referred to as "Changes with Files"), but I'm not having any luck in doing so with TeamCity 5.1. Any ideas?
I was able to get this to work in TeamCity 6 so I don't know if it works for 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 whatever appropriate FTL file) where I wanted to list the changed files I put:
<@common.build_changes_files var.changesBean/>
The help link you've mentioned references the variable var.buildChanges. I believe this is exactly what you're looking for.
精彩评论