My question:
I would like to obtain the current status of the quality gate for my projects in SonarQube via the SonarQube web api, but I do not see quality gate as an available metric in the documentation. What is the best way to access this information to include in a report?
Background:
I am using the SonarQube API to access information about project analyses. The output from the API is used to generate a weekly report. I can access the information about each project with the following SonarQube API call.
http://my-sonar-site/api/resources/index/?resource=$PROJECT_KEY&metrics=$METRIC_LIST
The metric list is populated from the SonarQube API documentation at
http://docs.sonarqube.org/display/SONAR/Metric+definitions
This gets me everything I want with the exception of the status of the quality gate.
What I've tried:
- I have looked through the documentation for metrics at the above link, but failed to find quality gate status in that part of the api.
- I have also looked at the quality gate API documented at http://nemo.sonarqube.org/api_documentation#api/qualitygates - but the quality gate API seems to be used for creating and managing quality gates and project associations rather than obtaining the current status of the gate on a per-project basis.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…