Get new issues in SonarQube brought in by current analysis via API

Viewed 45

I am using SonarQube community edition with Bitbucket server (awful combination - everything costs fortune in this combination) and wish to get new Blocker issues, brought in by current analysis. There could be several analysis executed in a row, so all I have is analysis id and quality gate. If quality gate fails, I wish to give my developers not only fact, that this analysis brought in some new Blocker issue, but indicate what is this issue. So far I tried to use api/issue to search for them, but there is no way to indicate that I want only new issues (or I do not see it); creation dates are taken from CVS information, updateDate does not match with time when analysis was running.

1 Answers

Naturally, best approach would be to buy Developer edition and forget about this, but there is things we could not overcome.

To solve this, I created separate project in SonarQube, where I am doing only PR analysis and, if quality gates fails there - there is huge chance, that data in PR is faulty.

Also, I created Powershell script and posted it as gist (it is pretty huge, so I am sharing it via link). In the root, this script will collect all issues in SonarQube project before analysis, then, if quality gates fails - it will collect issues after analysis and use diff to actually find issues and post them to Jira as new bugs, assigned to owner of build (we are using Bamboo and Jira integration).

Description of script could be read here, at my blog as well

Related