sonar quality gate in azure pipelines for .net projects

343 views Asked by At

We have set up sonar quality gate in our azure pipelines by using api key and using project_key as a paramater to fetch the quality gate status.

quality_gatesstatus=$(curl -u $sonar_token: https://$sonar_server/api/qualitygates/project_status?projectKey=$sonar_project_key | grep -Po '"status": *\K"[^"]*"')

Here in the above code we are fetching the quality status and storing it in quality_gatestatus variable and later using the same variable value and giving condition like:

 if [ "$quality_gatesstatus" != "OK" ] && [ "$quality_gatesstatus" != "NONE" ]
 then
 echo "check sonar server and fix the issues"
 exit 1 
 fi

But we need in to run it on Pull requests i.e master/develop branch. So how to use "analysysid" or any PR_id to run it on our PRs. Anyone help me on this please.

0

There are 0 answers