When Issues that I created in Sensor or custom Rules are available for Web Service API

When Issues that I created in Sensor or custom Rules are available for Web Service API calls
For example:
I create issue via custom JavaCheck


and in PostJob I want to modify that issue, for example, add comments
to get issues I use

https://docs.sonarqube.org/pages/viewpage.action?pageId=2392181
But some times issues aren’t created yet in PostJob phase

Could you help when I could be sure those issues are created and available for that Web Service API call

Hi @Vitalii_Mazurok

The report containing issues is sent to the server before the PostJob phase, but reports are processed on server side asynchronously. One simple way to do what you are trying to achieve is to wait for the report to be processed in your PostJob (using some polling). Depending on your CI system, it may be suboptimal, since you will consume build minutes doing nothing.

Another option that is better for CI agent occupation is to use a SonarQube webhook to notify an external component of your own (not a SonarQube plugin) that the analysis has been processed, and then do the changes you need on issues.

1 Like

Thanks @Julien_HENRY,
Could you provide API endpoint for reports?
Or some endpoint where I could detect that reports for this sonar scan were done?

You can look at this community plugin, they are probably doing something very close to what you want to achieve:

Basically the first step is to read the file report-task.txt to get the submitted taskId. Then poll a WS until the task is completed. The analysisId is not useful for you, because I don’t think you can query issues of a specific analysis. This will just let you know when the analysis has been processed.

1 Like