2

Can anyone suggest the best approach to writing a Jenkins/Hudson plugin, that will analyse the output of a "Sonar" action?

The idea is that I want to do something like this:

a. Checkout Code > b. Run Sonar > c. Email the developers their violations

Now, how would you write the c. part? I am not sure where to start.

Is anyone an expert in Jenkins plugins?

Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272

2 Answers2

2

You could use the "Build Breaker" Sonar plugin to break the Jenkins build whenever it detects a violation.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
James
  • 21
  • 2
1

The first thing I would do is to write the code that will find the (new) violations for each developer. For this you need some Sonar knowledge.

Then take a look at a plugin that does something similar to what you want to accomplish. As you want to send mails as a post-build step, I would suggest taking a look at the ext-email Plugin.

The Plugin-Tutorial in the Jenkins Wiki is a very good starting point to get you set up to start coding.

Great plugin idea btw, I'm very interested in the resulting plugin :-)

pushy
  • 9,535
  • 5
  • 26
  • 45
  • Interesting, so you would need to write a Sonar plugin as well for think you think? – Andriy Drozdyuk Sep 22 '11 at 17:25
  • This is not a functionality that is provided by the Sonar Jenkins Plugin right now. So either you create a new plugin or create an issue in the Sonar JIRA and wait until someone from Sonarsource gets around implementing that functionality. Of course you could also try and add this functionality to the Sonar Jenkins Plugin yourself. However, in the end, writing some plugin code will be necessary ;-) – pushy Sep 23 '11 at 07:11
  • Haha, I like your conclusion as to the necessity of writing some code :-) Do you think that this would be possible solely by writing a Jenkins plugin? – Andriy Drozdyuk Sep 28 '11 at 11:29