First of all thanks to @tmueller, @sashrika, @yousefhamza and Tanay Abhra who contributed code to TRUNK-4613 and all reviewers involved! Sonar reports no blocker and critical issues in OpenMRS core as of now.
We can move the bar a bit higher in keeping our code in good shape. We will now fail OpenMRS core build whenever blocker or critical issues are introduced.
If Bamboo turns red after your commit to openmrs-core, open up the build in Bamboo and if no tests are failing, it is most likely due to sonar issues. You can either look them up opening sonar reports at the bottom of the build page in shared artifacts or by going to https://ci.openmrs.org/sonar directly. If you open up a specific issue in Sonar it will give you instructions on how to fix it. If in doubt, just ask on IRC or here.
@raff, if Sonar can make the build fail, couldn’t it also show up as the reason for failure? The “if you don’t see a reason why the build is failing, look at X” approach sounds less than ideal. Ideally, the build will fail with the message “Sonar test X failing. See this url for more detail.” At a minimum, the build report/log for the failed build should say “Failed Sonar tests. See https://ci.openmrs.org/sonar for details.”
The build log actually says new issues found and lists the number of issues, but it does not say what is the URL of our sonar instance.
We experimented some time ago with customizing the e-mail template that is used by Bamboo when build is failing due to Sonar issues, but then our Bamboo got upgraded and templates were lost. @cintiadr, is there any easier way to do that in the current Bamboo version?
I’ve never modified the template of emails, but by documentation
tells me it’s in Bamboo home directory, so the upgrade wasn’t supposed to
affect it at all. I can see we have a
‘templates/notification-templates/BuildCompletedHtmlEmail.ftl’ file there,
but I cannot see any notifications
set for the sonar build. I would expect it to just work ™.
I don’t have experience with the Sonar itself or the Bamboo solar plugin
(apparently there are two
available, and we are using the one from Mibex), but looks like none of
them adds a result (success or failure) as a test (it doesn’t appear in the
If there’s a way to generate a junit format file, there’s a JUnit parser
task in Bamboo. It’s usually the simplest way of adding a ‘test’ to Bamboo.
An intelligible message in the build log would be most helpful. Are we using the Build Breaker? While there’s an old ticket complaining about lack of useful output (SONARPLUGINS-1968), the code appears to log alert text.
Thanks Cintia! Notifications are indeed disabled now. I will look into that. The hint about generating a junit format file sounds interesting too.
@burke, yes we are using the Build Breaker plugin.
That’s correct Lluis. We had a sonar build failing due to Java 8 configuration issue and once I fixed it, sonar reported 39 new critical issues, which need to be addressed. I tweaked the build to fail if any new issues are added, but pass for existing issues until they are fixed.
Notifications are enabled and e-mails will go to committers if they break the sonar build.