Skip to content

Commit 89198d2

Browse files
committed
Adding logs output for failed containers
1 parent fc50315 commit 89198d2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.github/workflows/build-test.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ jobs:
9898
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
9999
echo "ERROR: Timed out waiting for healthy containers"
100100
${DOCKER_CMD} ps
101+
102+
echo ""
103+
104+
echo "=== Failing container logs ==="
105+
106+
# Loop through failing containers and dump logs
107+
echo "$UNHEALTHY" | while read -r line; do
108+
NAME=$(echo "$line" | awk '{print $1}' | sed 's#^/##')
109+
110+
echo ""
111+
echo "----- Logs for $NAME -----"
112+
113+
# Try compose logs first (nicer formatting)
114+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} logs --no-color "$NAME" || \
115+
${DOCKER_CMD} logs "$NAME" || \
116+
echo "Unable to retrieve logs for $NAME"
117+
done
101118
exit 1
102119
fi
103120
done

0 commit comments

Comments
 (0)