-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,33 +19,9 @@ jobs: | |
- name: Build the Docker image | ||
run: docker compose up -d | ||
- name: Wait for HTTP 200 response | ||
run: | | ||
URL="https://localhost:7007" | ||
TIMEOUT=240 # Max time to wait in seconds | ||
SLEEP=5 # Time to wait between checks in seconds | ||
start_time=$(date +%s) | ||
while true; do | ||
# Send a request to the URL and get the status code | ||
STATUS=$(curl -o /dev/null -s -w "%{http_code}" "$URL") | ||
# Check if the status code is 200 | ||
if [ "$STATUS" -eq 200 ]; then | ||
echo "Success: HTTP 200 OK received from $URL" | ||
exit 0 | ||
fi | ||
# Check if the timeout has been exceeded | ||
current_time=$(date +%s) | ||
elapsed_time=$((current_time - start_time)) | ||
if [ "$elapsed_time" -ge "$TIMEOUT" ]; then | ||
echo "Error: Timeout of $TIMEOUT seconds exceeded. Last status: $STATUS" | ||
exit 1 | ||
fi | ||
# Wait for a while before checking again | ||
echo "Waiting for HTTP 200... Current status: $STATUS" | ||
sleep "$SLEEP" | ||
done | ||
uses: cygnetdigital/[email protected] | ||
with: | ||
url: 'https://localhost:7007/' | ||
responseCode: '200' | ||
timeout: 2000 | ||
interval: 500 |