File tree Expand file tree Collapse file tree 3 files changed +24
-30
lines changed
Expand file tree Collapse file tree 3 files changed +24
-30
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ echo " Checking the health of the containers..."
5+
6+ SERVICES=" $1 "
7+
8+ for service in $SERVICES ; do
9+ running=$( docker inspect -f ' {{.State.Running}}' " $service " 2> /dev/null || echo " false" )
10+
11+ if [ " $running " = " true" ]; then
12+ echo " $service is running ✔️"
13+ else
14+ exit_code=$( docker inspect -f ' {{.State.ExitCode}}' " $service " 2> /dev/null || echo " 1" )
15+ if [ " $exit_code " = " 0" ]; then
16+ echo " $service is stopped but exited with code 0 ✔️"
17+ else
18+ echo " ::error ::$service is stopped and exited with code $exit_code ❌"
19+ exit 1
20+ fi
21+ fi
22+ done
Original file line number Diff line number Diff line change 6565
6666 - name : Check container health
6767 run : |
68- echo "Checking the health of the containers..."
69-
70- SERVICES="${{ steps.services.outputs.services }}"
71-
72- for service in $SERVICES; do
73- running=$(docker inspect -f '{{.State.Running}}' "$service" 2>/dev/null || echo "false")
74-
75- if [ "$running" = "true" ]; then
76- echo "$service is running ✔️"
77- else
78- exit_code=$(docker inspect -f '{{.State.ExitCode}}' "$service" 2>/dev/null || echo "1")
79- if [ "$exit_code" = "0" ]; then
80- echo "$service is stopped but exited with code 0 ✔️"
81- else
82- echo "::error ::$service is stopped and exited with code $exit_code ❌"
83- exit 1
84- fi
85- fi
86- done
68+ ./.github/scripts/check-container-health.sh "${{ steps.services.outputs.services }}"
Original file line number Diff line number Diff line change 6565
6666 - name : Check container health
6767 run : |
68- echo "Checking the health of the containers..."
69-
70- SERVICES="${{ steps.services.outputs.services }}"
71- for service in $SERVICES; do
72- status=$(docker inspect -f '{{.State.Running}}' "$service" || echo "false")
73- echo "$service status: $status"
74- if [ "$status" != "true" ]; then
75- echo "::error ::Service $service is not running."
76- exit 1
77- fi
78- done
68+ ./.github/scripts/check-container-health.sh "${{ steps.services.outputs.services }}"
You can’t perform that action at this time.
0 commit comments