Upcoming Webinar!
From detection to resolution: Introducing AI CodeFix GA - Register Now!
Sonar Community
Result of quality gate status is coming back as null
SonarQube Cloud
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.
Related topics
Topic
Replies
Views
Activity
Get quality gate result from SonarCloud analysis with GitHub Actions
SonarQube Cloud
typescript
,
sonarqube-cloud
5
173
December 10, 2024
Get quality gate result from SonarCloud analysis with GitHub Actions
SonarQube Cloud
sonarqube-cloud
3
2518
September 29, 2021
Quality Gate failed: Could not fetch quality gate status
SonarQube Cloud
8
2275
August 13, 2024
Error running solarcloud analysis
SonarQube Cloud
4
2199
November 13, 2023
Make GH Action Job of Sonarcloud scan fail when quality gate is not passed
SonarQube Cloud
8
1413
December 16, 2022