REST api to request quality gate status by branch?


(Balázs Hosszu) #1

Hi Sonar Team!

The web api currently supports requesting the quality gate status of a project:
GET api/qualitygates/get_by_project

With recent developments now branches, both long and short lived, also have QG statuses, not just the master.
Are there plans to support requesting the branch specific quality gate status from the server?

The sonar-build-breaker is unmaintained and not compatible with latest releases. ( though a solution is present in a PR)
If the quality gate status could be requested for all kinds of builds on REST, a lightweight solution for to reimplement the QG build breaker might be possible, relying only on the public API, and no dependence on the Sonar Java package structure.

Thanks and cheers

P.s. thanks to the blogpost I see webhooks are also a possibility to solve this, and you do not suggest using buildbreakers.

(Gilbert Rebhan) #2


you may use the web api, api/project_analyses with the internal parameter branch and category QUALITY_GATE, see https://yoursonarhost/web_api/api/project_analyses?internal=true