LightBlog
Contact at mumbai.academics@gmail.com or 8097636691/9323040215
Responsive Ads Here

Sunday, 22 July 2018

CI - Build Failure Notifications

CI - Build Failure Notifications



A Build Failure Notification is an event which is triggered whenever a build fails. The notification is sent to all key people whenever a build fails. The first important thing to do in such a case is to ensure time is spent on the failed build to ensure the build passed. The following steps are used to ensure that the build notifications are put in place 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.
Email Notifier
Step 2 − Next step is to enter the details of a valid SMTP Server. Gmail provides a free SMTP facility, which can be used by anyone. So we can enter those details in the next screen that comes up as shown in the following screenshot.
  • SMTP Host – smtp.gmail.com
  • SMTP port no – 465
  • Send email messages from and SMTP login – This should be a valid Gmail id
  • SMTP password – Valid password for that Gmail id
  • Secure connection – Put this as SSL
SMPT Server
Step 3 − Click Test Connection just to ensure that the settings are working properly. Then click Save to save the settings.
Step 4 − The next step is to enable build notifications for a user. The first task is to create a user which will receive these build notifications. Go to your project dashboard and choose the Users Option.
Users Option
Step 5 − Create a new user. Enter the required username and password. Then Click the Create User button, which will be located at the bottom of the screen.
Create User Button
Step 6 − Now login to the TeamCity system with this new user id and password.
Team City User Id and Password
Step 7 − After you log in, you will be presented with the General settings of the user. In the Email Notifier section, click Edit.
General Settings of the User
Step 8 − In the next screen that comes up, click Add new rule.
Add New Rule
Step 9 − In Add new rule, choose the following two options and then click Save.
  • Builds from select projects – Choose the Demo project.
  • Enable the checkbox for ‘Build fails’.
By enabling these two options, now whenever a build fails for the Demo project, an email notification will be sent to the user – demouser.
Demo Project
Step 10 − Now let’s trigger a wrong build to see this in action. In Visual Studio, go to the demo.aspx.cs file and add a wrong line of code.
Demo ASPX Cs
Step 11 − Now check-in the code from Git by doing a git add and git commit.
Build Failure Git Add Command
Now in the Project Dashboard, the build will automatically be triggered and you will see that the build would have failed as shown in the following screenshot.
Project Dashboard Build Failure
If you login into the Gmail id of the demouser, you will actually see a build failure notification in it as shown in the following screenshot.
Team City Build Failure

No comments:

Post a Comment