Skip to content

Commit 17b2ab3

Browse files
committed
Enhances quality gate logging
Adds detailed output for failed conditions during quality gate checks and logs critical issues. Improves debugging by providing specific metric and issue details. Signed-off-by: DavidOsipov <[email protected]>
1 parent 0b1aaa4 commit 17b2ab3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,22 @@ jobs:
9090
STATUS=$(echo $QUALITY_GATE_RESPONSE | jq -r '.projectStatus.status')
9191
echo "Quality Gate Status: $STATUS"
9292
93+
# Print detailed condition information when status is not OK
9394
if [ "$STATUS" != "OK" ]; then
95+
echo "::group::Quality Gate Failure Details"
96+
echo "Failed conditions:"
97+
echo $QUALITY_GATE_RESPONSE | jq -r '.projectStatus.conditions[] | select(.status != "OK") | "- Metric: \(.metricKey), Status: \(.status), Error threshold: \(.errorThreshold), Actual value: \(.actualValue)"'
98+
echo "::endgroup::"
99+
100+
# Get project issues summary
101+
ISSUES_RESPONSE=$(curl --silent --fail --show-error \
102+
--header "Authorization: Bearer ${SONAR_TOKEN}" \
103+
"${SONAR_HOST_URL}/api/issues/search?projectKeys=${PROJECT_KEY}&resolved=false&severities=BLOCKER,CRITICAL&ps=10")
104+
105+
echo "::group::Critical Issues (showing up to 10)"
106+
echo $ISSUES_RESPONSE | jq -r '.issues[] | "- [\(.severity)] \(.message) | In file: \(.component)"'
107+
echo "::endgroup::"
108+
94109
echo "::error::Quality Gate check failed with status: $STATUS"
95110
echo "::error::Please check SonarQube analysis at ${SONAR_HOST_URL}/dashboard?id=${PROJECT_KEY}"
96111
exit 1

0 commit comments

Comments
 (0)