| You are viewing documentation of TeamCity 3.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version. |
|
Documentation Index
|
Notifier Templates ConfigurationIn this section you can find reference information on the location and syntax of notifier templates, connection with the build events, patterns used to represent important information, and examples: Notifier TemplatesLocationNotifier templates reside in the notifier configuration file:
Syntax notesSyntax of the notifier configuration files is described in the respective *.dtd files. Notifier configuration file contains two sections:
<templates>All templates are placed into the <templates> section, for example: <templates> <template id="build_failed_tpl"> <subject>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} successful {SHORT_STATUS_DESCRIPTION}</subject> <body>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} successful {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} </body> </template> </templates>
<events>Templates are attached to the notification events. For now supported events are:
If an event does not have a template attached, it is ignored, and the users will not receive notifications even if they subscribed to them. Example of events attachment: <events> <event type="build_failed"> <ref template="build_failed_tpl" /> </event> <event type="build_successful"> <ref template="build_successful_tpl" /> </event> </events> It is possible to attach template to a build configuration too: <event type="build_successful"> <ref template="build_successful_tpl"/> <ref template="build_successful_ant_tpl" build-type="Ant"/> </event> In this case for the build configuration with the "Ant" id, a template with the "build_successful_ant_tpl" id will be used (if it exists). For all other build configurations default template will be used (referenced here by the "build_successful_tpl" id). Substitution patternsEach notification event supports its own set of substitution patterns.
"build_started" event patterns
"build_successful", "build_failed" and "build_failing" events patterns
"responsible_changed" event patterns
ExamplesEmail notifier configuration<!DOCTYPE email SYSTEM 'email-config.dtd'> <email email-server='mail' email-server-port='25'> <events> <event type='build_started'> <ref template='build_started_tpl'/> </event> <event type='build_failed'> <ref template='build_failed_tpl'/> </event> <event type='build_failing'> <ref template='build_failing_tpl'/> </event> <event type='build_successful'> <ref template='build_successful_tpl'/> </event> <event type='responsible_changed'> <ref template='responsible_changed_tpl'/> </event> </events> <templates> <template id='build_started_tpl'> <subject>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} started.</subject> <body>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} started. Build results: {BUILD_RESULTS_LINK} {CHANGES} ============================================================================ Configure email notifications: {EDIT_NOTIFICATIONS_LINK} </body> </template> <template id='build_failing_tpl'> <subject>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failing {SHORT_STATUS_DESCRIPTION}</subject> <body>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failing {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS}{CHANGES} ============================================================================ Configure email notifications: {EDIT_NOTIFICATIONS_LINK} </body> </template> <template id='build_failed_tpl'> <subject>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failed {SHORT_STATUS_DESCRIPTION}</subject> <body>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failed {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS}{CHANGES} ============================================================================ Configure email notifications: {EDIT_NOTIFICATIONS_LINK} </body> </template> <template id='build_successful_tpl'> <subject>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} successful {SHORT_STATUS_DESCRIPTION}</subject> <body>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} successful {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS}{CHANGES} ============================================================================ Configure email notifications: {EDIT_NOTIFICATIONS_LINK} </body> </template> <template id='responsible_changed_tpl'> <subject>Responsible for {PROJECT_NAME}::{BUILD_CONFIG_NAME} failure has been changed.</subject> <body>Responsible for {PROJECT_NAME}::{BUILD_CONFIG_NAME} failure has been changed. Current responsible: {RESPONSIBLE} ============================================================================ Configure email notifications: {EDIT_NOTIFICATIONS_LINK} </body> </template> </templates> </email> Jabber notifier configuration<!DOCTYPE jabber SYSTEM "jabber-config.dtd"> <jabber server-host='jabber.some.domain' server-user='user' server-user-password='password'> <events> <event type='build_started'> <ref template='build_started_tpl'/> </event> <event type='build_failed'> <ref template='build_failed_tpl'/> </event> <event type='build_failing'> <ref template='build_failing_tpl'/> </event> <event type='build_successful'> <ref template='build_successful_tpl'/> </event> <event type='responsible_changed'> <ref template='responsible_changed_tpl'/> </event> </events> <templates> <template id='build_started_tpl'>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} started. Build results: {BUILD_RESULTS_LINK} {CHANGES} ============================================================================ Configure jabber notifications: {EDIT_NOTIFICATIONS_LINK} </template> <template id='build_failing_tpl'>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failing {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS} ============================================================================ Configure jabber notifications: {EDIT_NOTIFICATIONS_LINK} </template> <template id='build_failed_tpl'>Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} failed {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS} ============================================================================ Configure jabber notifications: {EDIT_NOTIFICATIONS_LINK} </template> <template id='build_successful_tpl'> Build {PROJECT_NAME}::{BUILD_CONFIG_NAME} {BUILD_NUMBER} successful {SHORT_STATUS_DESCRIPTION} Build results: {BUILD_RESULTS_LINK} {COMPILATION_ERRORS}{FAILED_TESTS_ERRORS} ============================================================================ Configure jabber notifications: {EDIT_NOTIFICATIONS_LINK} </template> <template id='responsible_changed_tpl'> Responsible for {PROJECT_NAME}::{BUILD_CONFIG_NAME} failure has been changed. Current responsible: {RESPONSIBLE} ============================================================================ Configure jabber notifications: {EDIT_NOTIFICATIONS_LINK} </template> </templates> </jabber> |