How to configure Sonarqube Quality Gate inorder to send an email alert every time there is a lower code coverage than thresold value

SonarQube Quality Gate is a great feature, but the only problem that I encountered is that we do not receive an email alert every time the codes have a lower level of code coverage than the quality value of gate thresold.

For example: Quality Gate Thresold value to cover the code with a new code <80% send an email alert

  • 1st analysis: code coverage is 85%
  • 2nd analysis: code coverage is 70% - an email alert has been received.
    - Gate condition quality: orange
    - threshold of a new quality: coverage of a new code <80 s
    ...
  • 3rd analysis: code coverage is 67% - no email alert received.
  • 4th analysis: code coverage is 50% - no email alert received.

Email notification is only accepted if the color / condition changes one to the other. We would like to set up an email alert for each analysis that will be performed, and if the code coverage on the new code is less than the thresold value, send an email.

+4
source share
2 answers

Automated emails can only be configured for the following points.

  • Changes to issues assigned to any user or reported by the user
  • New false positives
  • New problems
  • State of new quality (does not pass and goes to failure)

After the changes identified by sonar analysis are detected in the above items, SonarQube will send emails to each team member.

for more details, you can check the user profile.

0
source
  1. Sign in to the SonarQube Portal

  2. Click on the Administration tab

  3. By default, the Configuration tab is selected. Click on the General tab

  4. Search email in the browser or scroll down to the email tab

  5. Specify an email prefix according to your project requirements

    Default- [SONARQUBE] Custom - [companyname-SONARQUBE] 
  6. Provide the sender address

  7. Enter Name From

  8. Secure connection - startls or ssl

  9. Specify the name of the SMTP server. (for example, if you are setting up gmail, then the SMTP server is smtp.gmail.com )

  10. Enter your email password, SMTP port and & Username.

  11. You can test your email settings using test configuration options.

0
source

All Articles