This tutorial post will show you How to Configure Jenkins Mail notification for Build Failures.
When there is a build failure or any changes in the build state, we must get notified immediately through e-mail. so that we can fix the issue at the earliest. There is a mailer plugin available in Jenkins that has be installed and configure it based on the requirement.
If you are interested in learning, Request you to go through the below recommended tutorial.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
How to Configure Jenkins Mail Notification on Build Failures
Also You can Watch this Tutorial video on our YouTube Channel.
How to Configure Jenkins Mail Notification for Any Build Failures | Jenkins Tutorial
How to Configure Jenkins Mail Notification for Any Build Failures | Jenkins Tutorial
Let's get started.
Once you have logged into Jenkins portal with valid credentials.
Step 1: Install Mailer Plugin for Jenkins Mail Notification.
Go to "Manage Jenkins" available at the left side panel.
Select "Manage Plugins" from the Manage Jenkins Page.
Select "Manage Plugins" from the Manage Jenkins Page.
Go to "Available" tab and Search for "mailer" plugin in filter. Select the plugin "Mailer" and Click "Install without restart".
Once the "mailer" plugin is installed. Click "Go back to the top page", this will take you to the main page of jenkins.
Step 2 : Configure Mail with SMTP authentication
Again go to "Manage Jenkins" and select "Configure System".
Scroll down to find the field "Jenkins Location" and change "System Admin e-mail address" with your Name and E-mail address in the same format as shown in the below image. Because, this is the information about sender and sender mail address.
Now, Enter your SMTP Server name in the field "SMTP Server". For this example, I use my personal gmail address to get the mail notification, So I used gmail smtp server. Once this is completed, click "Advanced" button to provide the authentication details.
1. Enable "Use SMTP Authentication"
2. Enter your E-mail ID or username.
3. Enter your password.
4. Mark to "Use SSL".
5. Enter your SMTP Server Port Number.
Once above required information are given, We can check the configuration by sending a test mail.
So, select the option "Test configuration by sending test e-mail" and enter your mail address, click "Test Configuration" button to ensure the mail configuration works properly or not. If everything is ok, you will get an test e-mail from this jenkins server. Finally click on "Save".
Step 3 : Configure Jenkins Job Notification
Let's go back to main jenkins job queue and select the job which require notification.
Enter your recipients mail address and select first option "Send e-mail for every unstable build". Click "Save" button.
But, If the second option "Send separate e-mails to individuals who broke the build" is checked, the notification e-mail will be sent to individuals who have committed changes for the broken build (by assuming that those changes broke the build).
If e-mail addresses are also specified in the recipient list, then both the individuals as well as the specified addresses get the notification e-mail. If the recipient list is empty, then only the individuals will receive e-mails.
So we have configured mail notification for build jobs. If there is any failure in build or any changes in build state from failure to success or success to failure, you would get an mail notification.
Hope you have got an idea how to configure Jenkins mail notification for any build failure and build state changes. Going forward we will play more with Jenkins integration tool.
1 Comments
[…] + View More Here […]
ReplyDelete