#!/bin/sh set -eu cd "$(dirname "$0")/.." repo=$PWD project="hlpipe-lab4-clean-$(date -u +%Y%m%d%H%M%S)" dir="$repo/.verification/$project" out="$repo/${EVIDENCE_DIR:-evidence}/clean-clone.txt" sha=$(git rev-parse HEAD) [ ! -e "$out" ] || { echo "Choose a new EVIDENCE_DIR" >&2; exit 2; } mkdir -p "$(dirname "$dir")" "$(dirname "$out")" exec 3>&1 exec > "$out" 2>&1 cleanup() { status=$? trap - EXIT HUP INT TERM if [ -d "$dir/.git" ]; then cd "$dir" docker compose --profile bench --profile tools --profile reconcile down || status=1 docker volume ls --filter "label=com.docker.compose.project=$project" fi echo "exit_code: $status; volumes retained" sed "s#$repo##g" "$out" >&3 exit "$status" } trap cleanup EXIT trap 'exit 130' HUP INT TERM step() { echo "\$ $*"; "$@"; } export COMPOSE_PROJECT_NAME="$project" COMPOSE_FILE=compose.yaml export LB_HTTP_PORT=18084 LB_STATS_PORT=24845 BASE_URL=http://127.0.0.1:18084 export NO_PROXY=localhost,127.0.0.1,::1 unset API_IMAGE echo "date: $(date -u +%FT%TZ) commit: $sha project: $project" echo "HTTP=$LB_HTTP_PORT stats=$LB_STATS_PORT" step git clone --quiet --no-hardlinks "$repo" "$dir" cd "$dir" step git checkout --quiet --detach "$sha" step make secrets step docker compose --env-file .env config --quiet step make up step docker compose ps -a --format '{{.Service}} {{.State}} {{.Status}} {{.Ports}}' step make test step make test-persistence ACTION_SCRIPT=scripts/restart.sh step make test-failover ACTION_SCRIPT=scripts/stop-one.sh step docker compose ps -a --format '{{.Service}} {{.Name}} {{.State}}' api step make restore step make scenario SCENARIO=failover-upload step make restore step make scenario SCENARIO=s3-outage step sh scripts/s3-check.sh step make reconcile step make migrate step make down step docker volume ls --filter "label=com.docker.compose.project=$project"