API call to return latest version for a given quality gate status

(simon burgess) #1

I use a quality gate that focusses on leak checking to ensure specifically that no new issues are introduced (regardless of the current levels of debt). In order to do that, prior to scanning I set the leak period automatically from my CI system to a specific version i.e. the last known good build number (basically the last version that had a quality gate staus of success). It would be great if I could get last know good build version from a sonar api call rather than the kind of clunky solution i implemented within my CI system. Such an API call would just return the latest ‘project_version’ value for the 2 required parameters…project key and quality gate status (success/warn/error)

(Grégoire Aubert) #2


Indeed currently we don’t have a WS specifically for this use case.
But you could use api/measures/search_history to get the history of the metric alert_status (it’s the quality gate). Then you can go through the data to find the date of the last quality gate with a success status.

(simon burgess) #3

thanks will take a look