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?
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.
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.