Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity - customize email notification for specific Projects

I'm using TeamCity 5.1.5

I'd like to customize the email notification template on a per project basis.

Project A : use custom email notification email template to include additional info about the build and test results

Project B,C,D : use the default email notification template

I've perused through the TeamCity documentation and looked into the /config/_notifications/email directory and can't seem to find anything that indicates email templates can be configured on a per project basis. Any help is appreciated.

gracias!

like image 916
sogwiz Avatar asked Jul 30 '12 17:07

sogwiz


People also ask

How to setup email notification in TeamCity?

Following are the steps to set up email notifications in TeamCity. Step 1 − In TeamCity, go to your Project dashboard, click on Administration in the top right hand corner. You will then see the Email Notifier link in the left hand side. Click on this link to bring up the general settings for Email.


2 Answers

As far as I know, the template files can not be configured on a per-project basis.

However, using the FreeMarker expression syntax and properties provided by TeamCity, you can update the e-mail template to conditionally provide certain information for a given project.

For example:

<#if project.name = "Project A">
    Build Results: Passable
    Test Results: Smelly
</#if>
like image 141
Bilal Avatar answered Sep 19 '22 03:09

Bilal


Followed by @bilai, you can use build.name = "PROJECT_NAME" && buildType.name="CONFIGURATION_NAME" or buildType.externalId = "YOUR_BUILD_CONFIGURATION_ID" for more fine-grained control.

Check out my complete templete code: https://gist.github.com/YoungjaeKim/cf35ef3cba344a2f85e9

like image 37
Youngjae Avatar answered Sep 21 '22 03:09

Youngjae