Seq
This commit is contained in:
parent
ee6c695d33
commit
ab2b69aff3
1 changed files with 10 additions and 10 deletions
|
@ -21,22 +21,22 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Wait for service to be healthy
|
- name: Wait for service to be healthy
|
||||||
run: |
|
run: |
|
||||||
for i in {1..10}; do
|
for i in $(seq 1 10); do # Using `seq` for compatibility
|
||||||
echo "Checking website availability (Attempt $i)...";
|
echo "Checking website availability (Attempt $i)..."
|
||||||
STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:26400/) || true;
|
STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://website:8081/) || true # Ensure curl doesn't crash the script
|
||||||
if [ "$STATUS" -eq 200 ]; then
|
if [ "$STATUS" -eq 200 ]; then
|
||||||
echo "Website is up with status 200!";
|
echo "Website is up with status 200!"
|
||||||
break;
|
break
|
||||||
elif [ "$STATUS" -eq 000 ]; then
|
elif [ "$STATUS" -eq 000 ]; then
|
||||||
echo "Could not connect to website. Curl returned status: $STATUS";
|
echo "Could not connect to website. Curl returned status: $STATUS"
|
||||||
else
|
else
|
||||||
echo "Website not ready yet, status: $STATUS";
|
echo "Website not ready yet, status: $STATUS"
|
||||||
fi
|
fi
|
||||||
if [ "$i" -eq 10 ]; then
|
if [ "$i" -eq 10 ]; then
|
||||||
echo "Website did not become ready in time. Exiting...";
|
echo "Website did not become ready in time. Exiting..."
|
||||||
exit 1;
|
exit 1 # Explicit failure after 10 attempts
|
||||||
fi
|
fi
|
||||||
sleep 5;
|
sleep 5
|
||||||
done
|
done
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: https://code.forgejo.org/actions/checkout@v3
|
uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
|
|
Loading…
Reference in a new issue