Try multiple time for health api response
This commit is contained in:
@@ -122,24 +122,19 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
HEALTH_RESPONSE=$(curl -s 'http://localhost:3001/api/v1/health?force=true' \
|
MAX_RETRIES=5 # Total attempts (1 initial + 4 retries)
|
||||||
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
|
RETRY_INTERVAL=10 # Retry every 10 seconds after first failure
|
||||||
-H 'Accept-Language: en-US,en;q=0.9' \
|
|
||||||
-H 'Connection: keep-alive' \
|
|
||||||
-H 'Sec-Fetch-Dest: document' \
|
|
||||||
-H 'Sec-Fetch-Mode: navigate' \
|
|
||||||
-H 'Sec-Fetch-Site: none' \
|
|
||||||
-H "Authorization: Bearer $API_KEY" \
|
|
||||||
-H 'Sec-Fetch-User: ?1' \
|
|
||||||
-H 'Upgrade-Insecure-Requests: 1' \
|
|
||||||
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
|
|
||||||
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
|
|
||||||
-H 'sec-ch-ua-mobile: ?0' \
|
|
||||||
-H 'sec-ch-ua-platform: "macOS"')
|
|
||||||
|
|
||||||
echo "health_response<<EOF" >> $GITHUB_ENV
|
echo "Waiting 1 minute before the first health check..."
|
||||||
echo "$HEALTH_RESPONSE" >> $GITHUB_ENV
|
sleep 60 # Initial wait before first attempt
|
||||||
echo "EOF" >> $GITHUB_ENV
|
|
||||||
|
for ((i=1; i<=$MAX_RETRIES; i++)); do
|
||||||
|
echo "Attempt $i/$MAX_RETRIES: Checking health API..."
|
||||||
|
|
||||||
|
HEALTH_RESPONSE=$(curl -s 'http://localhost:3001/api/v1/health?force=true' \
|
||||||
|
-H "Authorization: Bearer $API_KEY")
|
||||||
|
|
||||||
|
echo "Health API Response: $HEALTH_RESPONSE"
|
||||||
|
|
||||||
WORKFLOWS_CREATE=$(echo "$HEALTH_RESPONSE" | jq -r '.workflows.create')
|
WORKFLOWS_CREATE=$(echo "$HEALTH_RESPONSE" | jq -r '.workflows.create')
|
||||||
WORKFLOWS_RUN=$(echo "$HEALTH_RESPONSE" | jq -r '.workflows.run')
|
WORKFLOWS_RUN=$(echo "$HEALTH_RESPONSE" | jq -r '.workflows.run')
|
||||||
@@ -155,10 +150,17 @@ jobs:
|
|||||||
|
|
||||||
if [ "$WORKFLOWS_CREATE" = "true" ] && [ "$WORKFLOWS_RUN" = "true" ] && [ "$WORKFLOWS_RUN_FINISHED" = "true" ] && [ "$WORKFLOWS_RUN_STATUS" = "FINISHED" ] && [ "$WORKFLOWS_DELETE" = "true" ]; then
|
if [ "$WORKFLOWS_CREATE" = "true" ] && [ "$WORKFLOWS_RUN" = "true" ] && [ "$WORKFLOWS_RUN_FINISHED" = "true" ] && [ "$WORKFLOWS_RUN_STATUS" = "FINISHED" ] && [ "$WORKFLOWS_DELETE" = "true" ]; then
|
||||||
echo "Health endpoint check was successful."
|
echo "Health endpoint check was successful."
|
||||||
else
|
exit 0
|
||||||
echo "Health endpoint check failed. Response did not meet expected criteria."
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$i" -lt "$MAX_RETRIES" ]; then
|
||||||
|
echo "Health check failed. Retrying in $RETRY_INTERVAL seconds..."
|
||||||
|
sleep $RETRY_INTERVAL
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Health check failed after $MAX_RETRIES attempts."
|
||||||
|
exit 1
|
||||||
- name: Get shuffle-orborus logs if health check fails
|
- name: Get shuffle-orborus logs if health check fails
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user