1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-01 17:38:36 +00:00

ci: Extend status check of docker

This commit is contained in:
Crown0815 2025-05-24 18:18:57 +02:00 committed by Crown0815
parent 4a91e35ada
commit 1afca44891

View file

@ -44,24 +44,40 @@ jobs:
shell: wsl-bash {0} shell: wsl-bash {0}
run: | run: |
apk --update add --no-cache docker curl apk --update add --no-cache docker curl
rc-update add docker default
# Check if Docker is already running, if not start it and wait for it to be ready # Check if Docker is already in the default runlevel before adding it
if ! pgrep -x dockerd > /dev/null; then if ! rc-status default | grep -q "docker"; then
service docker start rc-update add docker default || true
# Wait for Docker to be ready fi
echo "Waiting for Docker to be ready..."
timeout=30 # Check Docker service status
for i in $(seq 1 $timeout); do docker_status=$(rc-service docker status 2>&1 || echo "not running")
if docker info > /dev/null 2>&1; then
echo "Docker is ready!" # Start Docker only if it's not already running or starting
break if echo "$docker_status" | grep -q "not running"; then
fi echo "Starting Docker service..."
echo "Waiting for Docker to be ready... ($i/$timeout)" rc-service docker start || true
sleep 1
done
else else
echo "Docker is ready!" echo "Docker service status: $docker_status"
fi
# Wait for Docker to be ready regardless of how it was started
echo "Waiting for Docker to be ready..."
timeout=60
for i in $(seq 1 $timeout); do
if docker info > /dev/null 2>&1; then
echo "Docker is ready!"
break
fi
echo "Waiting for Docker to be ready... ($i/$timeout)"
sleep 1
done
# Final check to ensure Docker is working
if ! docker info > /dev/null 2>&1; then
echo "Docker is still not ready after waiting. Showing service status:"
rc-service docker status || true
exit 1
fi fi
- name: WSL - Start Forgejo Server - name: WSL - Start Forgejo Server