Web API to check if project analysis is in progress

(Keegan Witt) #1

My client has a Jenkins job that queries for issues (using curl against web API) on a project after running Gradle Sonarqube runner against the project. But if the curl call hits the API too soon (while the Sonarqube server is still churning on the latest results), it may return a false green.

It’d be useful if there were a method in the web API to check if an analysis is in progress for a particular project. I don’t see a way to do that currently. Please correct me if I’m mistaken.

(Julien Lancelot) #2

Hi Keegan,

I think what you really needs is to use a webhook : https://docs.sonarqube.org/latest/project-administration/webhooks/ which is sent when the analysis is complete.
So no need to pull on a web service and wait for the analysis to be finished, it will come to you !

Julien Lancelot

(Keegan Witt) #3

Thanks for the suggestion. In my particular case, that wouldn’t work. My client uses a single SonarQube instance for the whole company, and our Jenkins instances are federated (each team having their own). We’d hit the limit of webhooks real fast.

(Colin Mueller) #4

Hey Keegan,

The limit on webhooks is 10 globally and 10 per-project. If the project is setup to point to the correct Jenkins instance, problem solved!


(Keegan Witt) #5

Ah, I see. I misunderstood the limits. I’ll see if I can get the client’s admins to set it up for me (or give me admin rights on our project so I can set it up). But given their current configuration, this might be a fair amount of overhead for them – there are a lot of teams and projects.