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.
Table of Contents
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.
Click on Create User.
Fill the details as shown below and click on create.
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
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.
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
once your configured SMTP settings in SonarQube Email Notifications , send the test email if it is working
Login to gmail and check if email is received from sonarqube
Step #4: Enable SonarQube Email Notifications
To enable sonarqube Email Notifications, logout from SonarQube Admin account , Login again with newly created user with password.
Click on Notifications and you can search for specific project and Enable SonarQube Email Notifications as shown below
once enabled, you will get SonarQube Report via email, whenever project is triggered by sonar scanner.
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