Configure SonarQube Email Notifications [2 steps]

In this article , We are going to cover Creating User and Group in SonarQube, Configure SonarQube Email Notifications, Enable SonarQube Email Notification to receive SonarQube code analysis report.

Introduction

SonarQube is an opensource web based tool to manage code quality and code analysis. It is most widely used in continuous code inspection which performs reviews of code to detect bugs, code smells and vulnerability issues of programming languages such as PHP, C#, JavaScript, C/C++ and Java.

Prerequisite

  • Preinstalled SonarQube with access

Step #1: Setup SonarQube

Please follow below articles if you not installed SonarQube

How to Install SonarQube on Ubuntu 20.04 LTS

How to Install SonarQube on Ubuntu 18.04/16.04 LTS

Step #2: Creating User and Group in SonarQube

you can setup default notification to Admin account OR you can create group , user project wise in sonarqube.

To create new user in SonarQube, First login to SonarQube GUI using admin user and password.

once logged in Navigate to Administration > Go to Security > click on Users shown below.

Configure SonarQube Email Notifications [2 steps] 1

Click on Create User.

Configure SonarQube Email Notifications [2 steps] 2

Fill the details as shown below and click on create.

Configure SonarQube Email Notifications [2 steps] 3

If you want to create project wise group , you can add users in specific group. To create Group in SonarQube Navigate to Administration > click on Security > click on Groups > click on Create Group > Enter Name of Group > click on Create

Configure SonarQube Email Notifications [2 steps] 4

To add user in SonarQube Navigate to Administration > Security > Users > Click on Groups Column icon in member section, select the user and click on Done.

Configure SonarQube Email Notifications [2 steps] 5

Step #3: Configure SonarQube Email Notifications

To configure SonarQube Email Notifications Navigate to Administration > click on Configuration -> scroll down to Email Section, fill the SMTP details as per your project requirement.

Here we have configured GMail SMTP for SonarQube Email Notifications.

Email prefix: Prefix will be prepended to all outgoing email subjects – SonarQube Email Notifications

From address: Emails will come from this address – Gmail ID

From name: Emails will come from this address name – SonarQube Email Notifications

Secure connection: Type of secure connection – starttls

SMTP host: smtp.gmail.com

SMTP password: Email ID password

SMTP port: Port number to connect with SMTP server – 587/465

SMTP username: Username to use with authenticated SMTP – Email ID

Configure SonarQube Email Notifications [2 steps] 6

once your configured SMTP settings in SonarQube Email Notifications , send the test email if it is working

Configure SonarQube Email Notifications [2 steps] 7

Login to gmail and check if email is received from sonarqube

Configure SonarQube Email Notifications [2 steps] 8

Step #4: Enable SonarQube Email Notifications

To enable sonarqube Email Notifications, logout from SonarQube Admin account , Login again with newly created user with password.

Configure SonarQube Email Notifications [2 steps] 9

Click on Notifications and you can search for specific project and Enable SonarQube Email Notifications as shown below

Configure SonarQube Email Notifications [2 steps] 10

once enabled, you will get SonarQube Report via email, whenever project is triggered by sonar scanner.

Configure SonarQube Email Notifications [2 steps] 11

Conclusion

We have covered, Creating User and Group in SonarQube, Configure SonarQube Email Notification, Enable SonarQube Email Notifications

Related Articles

SonarQube Properties for Node JS Project [ 3 steps]

Reference

SonarQube Official Guide

FOSS TechNix

FOSS TechNix (Free,Open Source Software's and Technology Nix*) founded in 2019 is a community platform where you can find How-to Guides, articles for DevOps Tools,Linux and Databases.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link