I want write script as Command Line in TeamCity for break my assembly. I using SonnarQube v: 7.....
My script is:
set PROJECTKEY="%sonar.proj.key%"
set QGSTATUS=`"%curl.exe%" -s -u
http://SONNAR_URL:9000/api/qualityates/project_status?projectKey=$PROJECTKEY
if "%%QGSTATUS%%" == "OK" exit 0
if "%%QGSTATUS%%" == "ERROR" exit 1
But request
http://SONNAR_URL:9000/api/qualityates/project_status?projectKey=$PROJECTKEY
return for example this message:
"projectStatus": {
"status": "ERROR",
"conditions": [
{
"status": "ERROR",
"metricKey": "new_security_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "5"
},
{
"status": "ERROR",
"metricKey": "new_reliability_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "3"
},
{
"status": "OK",
"metricKey": "new_maintainability_rating",
"comparator": "GT",
"periodIndex": 1,
"errorThreshold": "1",
"actualValue": "1"
},
But I need, that api requst return me only status "Failed" or Error.
It's necessary for break my assembly in TeamCity
Script from hear (Quality Gate Failure in SonarQube does not fail the build in Teamcity)
not working for me, maybe because I using SonnarQube v 7...
How write correct script for TeamCity or how write correct API request, that get one word - Error or Ok