Skip to content

Commit

Permalink
holy
Browse files Browse the repository at this point in the history
  • Loading branch information
GameKnave committed Feb 18, 2025
1 parent 2d585a5 commit 6389365
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,13 @@ jobs:
run: |
#!/bin/bash
# Extract TASK_ID safely
TASK_FILE=".scannerwork/report-task.txt"
echo "TASK_FILE=$TASK_FILE"
if [[ ! -f "$TASK_FILE" ]]; then
echo "Error: Sonar task file not found: $TASK_FILE"
exit 1
fi
echo "Contents of TASK_FILE:"
cat "$TASK_FILE"
TASK_ID=$(grep "ceTaskId" "$TASK_FILE" | cut -d= -f2 | tr -d '[:space:]')
if [[ -z "$TASK_ID" ]]; then
Expand All @@ -116,16 +112,21 @@ jobs:
RETRY_DELAY=10 # Wait time in seconds
TRIES=0
while [[ $TRIES -lt $MAX_RETRIES ]]; do
while ((TRIES < MAX_RETRIES)); do
# Fetch task status from SonarCloud
curl -s -u "***:" "https://sonarcloud.io/api/ce/task?id=$TASK_ID" -o task.json
# Check if the response file exists and contains data
if [[ ! -s task.json ]]; then
echo "Warning: Empty response from SonarCloud. Retrying..."
sleep $RETRY_DELAY
((TRIES++))
continue
fi
# Output the entire task response for debugging
echo "Task API Response: $(cat task.json)"
STATUS=$(grep -o '"status":"[^"]*"' task.json | cut -d: -f2 | tr -d '"')
if [[ -z "$STATUS" ]]; then
Expand All @@ -146,6 +147,11 @@ jobs:
fi
((TRIES++))
if [[ "$TRIES" -ge "$MAX_RETRIES" ]]; then
echo "SonarCloud analysis taking too long. Exiting."
exit 1
fi
echo "Waiting for SonarCloud to complete analysis... (Attempt $TRIES/$MAX_RETRIES)"
sleep $RETRY_DELAY
done
Expand All @@ -171,5 +177,4 @@ jobs:
echo "Quality Gate passed successfully!"
shell: bash

0 comments on commit 6389365

Please sign in to comment.