check / check (push) Canceled after 0s
The workflow's script/docker-smoke step is removed, so the workflow checks out the repo and runs script/cibuild and nothing else, as the canonical REPO_POLICIES.md says. The owner ruled on the issue that make check covers what needs covering. CI no longer starts the image and waits for its healthcheck. script/docker-smoke and make docker-smoke stay, to run by hand, and the script's header comment no longer says the workflow runs it. The dated TODO.md entries that say the workflow runs it are history and stay as written. Model: opus-5-5
47 lines
1.5 KiB
Bash
Executable File
47 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# script/docker-smoke: build the Docker image, start it, and wait up to
|
|
# 30 seconds for its HEALTHCHECK to report healthy. It is not part of
|
|
# script/check, which never starts the image, and the Gitea workflow
|
|
# does not run it. Run it by hand.
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
|
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
"$SCRIPT_DIR/docker"
|
|
|
|
# A fresh random key: the container publishes no port and is
|
|
# removed on exit.
|
|
key="$(head -c 32 /dev/urandom | base64)"
|
|
|
|
# Docker 25 and later probe every 5 seconds during the image's
|
|
# 10-second start period. --health-interval=1s makes it probe every
|
|
# second after that instead of every 30, so a slow start still shows
|
|
# as healthy within the 30-second wait.
|
|
cid="$(docker create --health-interval=1s \
|
|
-e PIXA_SIGNING_KEY="$key" "$("$SCRIPT_DIR/projectname")")"
|
|
# Remove the container on any exit; turning signals into exit makes
|
|
# an interrupted run clean up too.
|
|
trap 'docker rm -f "$cid" >/dev/null' EXIT
|
|
trap 'exit 1' HUP INT TERM
|
|
docker start "$cid" >/dev/null
|
|
|
|
deadline=$(($(date +%s) + 30))
|
|
while [ "$(date +%s)" -lt "$deadline" ]; do
|
|
health="$(docker inspect --format '{{.State.Health.Status}}' "$cid")"
|
|
if [ "$health" = healthy ]; then
|
|
echo "docker-smoke: container is healthy"
|
|
return 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
echo "docker-smoke: container not healthy after 30 seconds; its log:" >&2
|
|
docker logs "$cid" >&2
|
|
return 1
|
|
}
|
|
|
|
main "$@"
|