-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45a480c
commit de8290f
Showing
4 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/.github/ | ||
/dist/ | ||
/node_modules/ | ||
/scripts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Test that a container image sees a 'healthy' state" | ||
echo | ||
echo "Usage: $0 IMAGE" | ||
echo "Example: $0 sha256:fe8a5ea609e0f377bf4d6aa96f9dd9743caa7048a1c93c9632661f774e20f308" | ||
exit 1 | ||
fi | ||
|
||
function finish() { | ||
echo "Stopping the container" | ||
docker stop "$container" | ||
echo "Logs from the container" | ||
docker logs "$container" | ||
echo "Removing the container" | ||
docker rm "$container" | ||
} | ||
|
||
trap finish EXIT | ||
|
||
echo "Starting the container" | ||
container=$(docker run --env SLACK_ACCESS_TOKEN=token --env REDIS_URI="redis://host.docker.internal:$REDIS_PORT" --add-host=host.docker.internal:host-gateway --detach "$1") | ||
|
||
timeout --foreground 20 bash << EOT | ||
while true; do | ||
current=\$(docker inspect "${container}" | jq --raw-output '.[0].State.Health.Status') | ||
echo "${container} is in state: \${current}" | ||
if [ "\$current" == "healthy" ]; then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
EOT |