36 lines
968 B
Bash
Executable File
36 lines
968 B
Bash
Executable File
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
MERGED_FILE="$(mktemp)"
|
|
trap 'rm -f "$MERGED_FILE"' EXIT
|
|
|
|
docker compose -f docker-compose.yml -f docker-compose.release.yml config > "$MERGED_FILE"
|
|
|
|
check_service_bind_mount() {
|
|
service_name="$1"
|
|
if awk -v service=" ${service_name}:" -v root="$ROOT_DIR" '
|
|
BEGIN { in_service = 0 }
|
|
$0 == service { in_service = 1; next }
|
|
in_service && /^ [a-zA-Z0-9_]+:/ { in_service = 0 }
|
|
in_service && /source: / {
|
|
if (index($0, root) > 0) {
|
|
print $0
|
|
exit 1
|
|
}
|
|
}
|
|
' "$MERGED_FILE"; then
|
|
printf "OK: %s has no source bind mount from repository path.\n" "$service_name"
|
|
else
|
|
printf "ERROR: %s still has a source bind mount from repository path in release config.\n" "$service_name" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check_service_bind_mount "web"
|
|
check_service_bind_mount "scheduler"
|
|
|
|
echo "Release topology verification passed."
|