I am using this below CURL statement:
curl -u $SONAR_TOKEN: https://$SONAR_SERVER/api/qualitygates/project_status?projectKey=$SONAR_PROJECT_KEY\&pullRequest=$SONAR_PR_KEY
Using IF
statement to pass/fail the above scenario.
if [ "$quality_gatesstatus" != "OK" ] && [ "$quality_gatesstatus" != "WARN" ]; then
echo "check sonar server and fix the issues: $quality_gatesstatus"
exit 1
else
echo "Sonar Quality gate succeeded!!!"
fi
But either of the true/false condition it is only printing first echo statement and failing the job. So what is the mistake I am doing here, one more things I cannot use "jq".
Without
jq
this should to the trick: