简体   繁体   中英

How to retrieve SonarQube metrics of previous build versions through the api?

How do I get the measures (like code-coverage, technical debt, complexity, nloc, ...) of a certain build version (eg. 1.0.0.20) from the api of SonarQube?

My goal is to get these information and display it along with some-other info pertaining to that version got from other sources like bitbucket.

I am able to only see the measures of the current (latest) build (eg. 1.0.0.45) version through the api/measure/component api link.

Although, I can see these measures for individual builds through the UI under the compare option. But how to get it through rest api?

SonarQube Version 5.5

Plugins :

  • sonar-scoverage-plugin-5.1.3.jar
  • sonar-scm-git-plugin-1.2.jar
  • sonar-scalastyle-plugin-0.0.1-SNAPSHOT.jar
  • sonar-javascript-plugin-2.11.jar

First of all, SonarQube 5.5 is old, you should first consider using the latest LTS (5.6) in order to be able to get feedbacks.

Versions of projects can be found by using :

  • api/events/index (it's replaced by api/project_analyses/search in 6.3) -> it will return you the date of analysis on which there's a version.

And in order to get measures from the past, you can use :

  • api/timemachine/index (it's replaced by api/measures/search_history in 6.3) -> you'll be able to found the measures from the version you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM