Sonarqube issue failed alert through jenkins mail

scanner
sonarqube

(nithin akua) #1

Hi @Channel,

How to send a mail through jenkins if we get any issue and sonar scan failed to the particular developer who committed that code.

Is it possible? If yes let me know how to figure it out.


(G Ann Campbell) #2

Hi,

There are 2 ways you could go here, the one you suggest, and the one I recommend. I’ll cover both:

You suggest: sending notifications though Jenkins

  • Okay, so let’s say you have your CI set up to fire an analysis per commit.
  • Let’s further say that you’ve set up your Quality Gate to fail if any New Issues are added.
  • Now you need to have Jenkins fail the build on Quality Gate failure
  • and configure the Jenkins job to send notifications to the committers who contributed to a failing build

…and there you go. Easy-peasy?

I recommend: having SonarQube send notifications

  • make sure SonarQube is configured to be able to send email (Administration > General Settings > Email) (Oops! I left this step off of the Jenkins list!)
  • persuade your developers to subscribe to “My New Issues” notifications.

And yes, there must be persuasion here. You cannot proactively subscribe other users to the notifications you think they should want.

 
Ann