Files
mtusi2026lab2/scripts/clean-clone.sh
T
Artyom 12db77133f Forward the lab 5 foundation while preserving lab 6 telemetry
Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files.

Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
2026-11-06 12:29:35 +03:00

55 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
repo=$PWD
project="hlpipe-lab6-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#<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=18086 LB_STATS_PORT=26085 BROKER_MANAGEMENT_PORT=26086 BASE_URL=http://127.0.0.1:18086
export PROMETHEUS_PORT=26090 LOKI_PORT=26310 TEMPO_PORT=26320 GRAFANA_PORT=26300
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"