Hi Team,
I am using Sonarqube Community Edition Version 9.8.
I want to retrieve the coverage details of the latest scanned build along with buildstring detail from sonarqube web api.
Using the below API, I’m able to retrieve the required details of a particular file from the latest build. But I could’nt get the buildstring details. I want to know the coverage details belongs to which build.
buildstring is a build id which will be passed as an argument ‘sonar.buildString’ to sonar-scanner cli. It is a unique id which is used to differentiate with other builds. It will be displayed in activity page as well.
My requirement is to retrieve the latest build’s coverage details using sonarqube web api. I would like to retrieve the coverage details along with its build id. Kindly suggest.
And one more doubt. If we pass the new_coverage as the parameter in the sonarqube measures/component web api , will it provide latest code coverage details ?
You should be able to retreive the build string for an analysis using GET api/project_analyses/search.
In any case, you’ll find this guide useful:
And one more doubt. If we pass the new_coverage as the parameter in the sonarqube measures/component web api , will it provide latest code coverage details ?
This will provide coverage details specifically for code in the New Code Period. coverage will provide overall coverage.
Thanks @Colin for sharing the guide. It’s very useful.
New Code Period is set to ‘previous version’. But in my sonarqube dashboard, the coverage shown under ‘new code’ is different from the coverage which is shown in the graph in today’s latest build. Is new_code not related to latest build? plz clarify.
overall code means is it containing the coverage details of all the files/folders of the latest build or it has the data of previous builds as well? plz clarify.