Remove Quality Gate wait step from SonarQube workflow to simplify the analysis process and improve efficiency.
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m54s
All checks were successful
SonarQube Analysis / Build and analyze (push) Successful in 1m54s
This commit is contained in:
29
.github/workflows/sonarqube.yml
vendored
29
.github/workflows/sonarqube.yml
vendored
@@ -67,32 +67,3 @@ jobs:
|
|||||||
echo "Ending SonarQube analysis..."
|
echo "Ending SonarQube analysis..."
|
||||||
~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
|
~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
|
||||||
|
|
||||||
- name: Wait for Quality Gate
|
|
||||||
run: |
|
|
||||||
echo "Waiting for SonarQube Quality Gate result..."
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
# Get Quality Gate status using jq for proper JSON parsing
|
|
||||||
RESPONSE=$(curl -s -u "${{ secrets.SONAR_TOKEN }}:" \
|
|
||||||
"${{ secrets.SONAR_HOST_URL }}/api/qualitygates/project_status?projectKey=AIImages")
|
|
||||||
|
|
||||||
echo "API Response: $RESPONSE"
|
|
||||||
|
|
||||||
# Install jq if not available
|
|
||||||
if ! command -v jq &> /dev/null; then
|
|
||||||
sudo apt-get update && sudo apt-get install -y jq
|
|
||||||
fi
|
|
||||||
|
|
||||||
QUALITY_GATE_STATUS=$(echo "$RESPONSE" | jq -r '.projectStatus.status')
|
|
||||||
|
|
||||||
echo "Quality Gate Status: $QUALITY_GATE_STATUS"
|
|
||||||
|
|
||||||
if [ "$QUALITY_GATE_STATUS" != "OK" ]; then
|
|
||||||
echo "❌ Quality Gate failed! Status: $QUALITY_GATE_STATUS"
|
|
||||||
echo "Please check the SonarQube dashboard for details:"
|
|
||||||
echo "${{ secrets.SONAR_HOST_URL }}/dashboard?id=AIImages"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "✅ Quality Gate passed!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user