[WEBINAR] Code Faster, Write Cleaner with AI Coding Assistants and Sonar - EMEA & APJ - April 23
Register Now
Sonar Community
Result of quality gate status is coming back as null
SonarCloud
demola-gigxpad
(Demola Gigxpad)
January 6, 2023, 10:15am
1
ALM used GitHub
CI system used GitHub actions
jobs:
sonarcloud:
#needs:
[ on-success ]
name: SonarCloud
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis…
name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.PAT }} # Needed to get PR information, if any exist
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#run:
npx sonarqube-scanner
name: Get SonarCloud quality gate status
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
RESULT=$(curl -u “$SONAR_TOKEN:” “
https://sonarcloud.io/api/qualitygates/project_status?projectKey=GIGXPad-com_xpad-web-v2&analysisId=$SONAR_ANALYSIS_ID
”)
STATUS=$(echo $RESULT | jq -r .status)
echo $STATUS
name: Check quality gate status
if: ${{ env.STATUS == ‘ERROR’ }}
run: |
echo “Quality gate status is ERROR”
exit 1
Colin
(Colin)
January 9, 2023, 11:08am
2
Hey there.
Please don’t raise duplicate threads. I will close this one.