Consistency of sonar-scanner vs Web API Component Measures

SonarQube - Version 9.9.3
Deployed with - Docker
Trying to Achieve - Understanding for optimal performance

I need to run sonar-scanner to update a Project, then use the Web API (/api/measures/component) to get the value of all Measures for that Project which must include any updates from the sonar-scanner run.

My question is, can I simply run sonar-scanner, wait for it to return, then make the /api/measures/component API call, or do I need to wait for all Pending Tasks for the given Project Branch to complete (using something like /api/ce/component) before making my call to /api/measures/component?

For reference, I’ve tested and it seems like for my average project, /api/ce/component says there are Pending Tasks on the Project Branch for about 40 seconds after sonar-scanner returns.

Thanks!

Hi,

don’t know how your analysis runs.
I had a similar requirement, needed the scanner context of an analysis and it’s only available after the CE background task has finished.

I simply put my rest call after the waitForQualityGate() in the Jenkins pipeline to be sure the analysis has finished.

see

Gilbert