Customizing FTL Notification Templates

We're currently using Jabbr (via GoogleTalk) to get sent build notifications.

I'm trying to figure out how to customize the .ftl files, but i can't find a reference point that lists all the TeamCity variables available to the template?

3 comments
Comment actions Permalink

Hi Ryan,

The exact list of available variables depends on event, generally there is a project, build configuration, build, etc.
Please take a look here: http://confluence.jetbrains.net/display/TCD7/Customizing+Notifications
Also note that most templates use all available variables, additional ones should be added via plugins.


--
Maxim

0
Comment actions Permalink

I saw that page, but i can't see where it lists all the available variables - it's a bit confusing.

Essentially all we want is for Build started event:

"Build triggered by <Git User who triggered build - e.g the commit> <linktobuild on TC>"

And on Build completed event:

"Build succeeded. <linktobuild on TC>"

0
Comment actions Permalink

I think you don't fully understand the object model used in FreeMarker.
TeamCity provides root variables to the template (${project}, ${buildType}, ${build}, ${buildServer}, ... - take a look closely and you'll find them on that page with their types). These are real java objects, of which methods can be called, e.g. "Project.getName()" or "Build.getTriggeredBy()" (which would be ${project.name}, ${build.triggeredBy} in the template).
For the list of methods available please refer to our javadoc: http://javadoc.jetbrains.net/teamcity/openapi/current/
Besides some commonly used URLs are pre-calculated for you and passed to the template (their are also listed in the document), e.g. ${link.buildResultsLink} would be an URL of the build.


--
Maxim

0

Please sign in to leave a comment.