who_need_help/scripts/e2e-stop.sh

43 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -eu
if [ "$#" -ne 1 ]; then
echo "Usage: $0 who_need_help_e2e_RUN_ID" >&2
exit 1
fi
project=$1
case "$project" in
who_need_help_e2e_*) ;;
*)
echo "Refusing to stop a non-E2E Compose project: $project" >&2
exit 1
;;
esac
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
# Compose still resolves required interpolation values for `down`. These values
# mirror the isolated runner and do not select containers; the project label
# passed above is the scope used by Compose for removal.
export APP_IMAGE="who-need-help:e2e"
export SOCKET_PROXY_IMAGE="who-need-help:socket-proxy-e2e"
export POSTGIS_IMAGE="who-need-help:postgis-e2e"
export E2E_OUTPUT_DIR="$ROOT/output/e2e/stop-placeholder"
export E2E_UID
E2E_UID=$(id -u)
export E2E_GID
E2E_GID=$(id -g)
export TRAEFIK_PROJECT_CONSTRAINT="$project"
export TRAEFIK_APP_NAME="$project"
export TRAEFIK_DOCKER_NETWORK="${project}_ingress"
export MAP_TILE_URL="https://proxy/__e2e__/map-tile.png?z={z}&x={x}&y={y}"
docker compose \
--project-name "$project" \
--env-file "$ROOT/.env.e2e" \
--file "$ROOT/compose.yaml" \
--file "$ROOT/compose.e2e.yaml" \
down --volumes --remove-orphans