Skip to content

Commit 73baaef

Browse files
ci: fail on integration (#849)
1 parent dc6fb49 commit 73baaef

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

.github/workflows/integration.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,43 @@ jobs:
2626
- name: Docker Compose Logs
2727
run: docker compose logs
2828

29-
# 2) Check if any containers have exited with an error
29+
# 2) Check if any containers have exited with an error or are unhealthy
3030
- name: Check containers status
3131
run: |
32+
# Create a flag to track if we found any issues
33+
FOUND_ISSUES=0
34+
3235
# If any container's STATUS shows "Exit" or "exited", fail
33-
# because that means the container died or crashed.
3436
if docker compose ps | grep -q 'Exit'; then
3537
echo "A container has exited with an error."
38+
FOUND_ISSUES=1
39+
fi
40+
41+
# Check exit codes for any stopped containers
42+
for container in $(docker compose ps -q); do
43+
if [[ $(docker inspect --format='{{.State.Status}}' $container) == "exited" ]]; then
44+
EXIT_CODE=$(docker inspect --format='{{.State.ExitCode}}' $container)
45+
if [[ $EXIT_CODE -ne 0 ]]; then
46+
echo "Container $container exited with non-zero exit code: $EXIT_CODE"
47+
FOUND_ISSUES=1
48+
fi
49+
fi
50+
done
51+
52+
# Check logs for panic messages
53+
if docker compose logs | grep -i "panic" | grep -v "panic = 'abort'"; then
54+
echo "Found panic messages in logs."
55+
FOUND_ISSUES=1
56+
fi
57+
58+
# Check logs for ERROR messages
59+
if docker compose logs | grep -i "ERROR"; then
60+
echo "Found ERROR messages in logs."
61+
FOUND_ISSUES=1
62+
fi
63+
64+
# Fail the build if any issues were found
65+
if [[ $FOUND_ISSUES -eq 1 ]]; then
3666
exit 1
3767
fi
3868

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
ports:
99
- "25565:25565"
1010
command: [ "--server", "tag:35565", "0.0.0.0:25565" ]
11-
# restart: unless-stopped
11+
restart: "no"
1212
environment:
1313
- RUST_LOG=info
1414
networks:
@@ -26,7 +26,7 @@ services:
2626
expose:
2727
- "35565"
2828
command: [ ]
29-
# restart: unless-stopped
29+
restart: "no"
3030
environment:
3131
- RUST_LOG=info
3232
networks:
@@ -38,7 +38,7 @@ services:
3838
dockerfile: Dockerfile
3939
target: rust-mc-bot
4040
command: [ "hyperion-proxy:25565", "500", "2" ]
41-
# restart: unless-stopped
41+
restart: "no"
4242
depends_on:
4343
- hyperion-proxy
4444
environment:

0 commit comments

Comments
 (0)