Files
light-heart-labs--dreamserver/ods/extensions/library/validate-compose.sh
T
wehub-resource-sync 9e8f1bbeed
Dashboard / frontend (push) Failing after 0s
Dashboard / api (push) Failing after 0s
Lint PowerShell / powershell-lint (ubuntu-latest) (push) Failing after 1s
Python Lint / Lint Python with Ruff (push) Failing after 1s
ShellCheck / Lint shell scripts (push) Failing after 1s
Matrix Smoke / linux-smoke (push) Failing after 1s
Matrix Smoke / distro: cachyos (push) Failing after 15s
Matrix Smoke / distro: linux-mint-21.3 (push) Failing after 15s
Matrix Smoke / distro: debian-12 (push) Failing after 5m21s
Matrix Smoke / distro: fedora-41 (push) Failing after 4m56s
Matrix Smoke / distro: ubuntu-24.04 (push) Failing after 2m13s
Matrix Smoke / distro: rocky-9 (push) Failing after 10m39s
Matrix Smoke / distro: manjaro (push) Failing after 12m11s
Matrix Smoke / distro: opensuse-tw (push) Failing after 11m53s
Matrix Smoke / distro: archlinux (push) Failing after 20m3s
Matrix Smoke / distro: ubuntu-22.04 (push) Failing after 13m49s
Validate .env Schema / tier-1-env-validation (push) Successful in 52s
Validate .env Schema / tier-2-env-validation (push) Successful in 44s
Validate .env Schema / tier-3-env-validation (push) Successful in 52s
Validate .env Schema / tier-4-env-validation (push) Successful in 51s
Validate Extensions Catalog / Check catalog is up-to-date (push) Failing after 9m47s
Secret Scan / Scan for secrets (push) Failing after 21m4s
Validate Docker Compose / Validate Docker Compose files (push) Has been cancelled
Python Type Check / Type check with mypy (push) Has been cancelled
Validate .env Schema / tier-0-env-validation (push) Has been cancelled
Test Linux / integration-smoke (push) Has been cancelled
Lint PowerShell / powershell-lint (windows-latest) (push) Has been cancelled
Matrix Smoke / macos-smoke (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:33 +08:00

99 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BOLD='\033[1m'
RESET='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SERVICES_DIR="${SCRIPT_DIR}/services"
# Check docker availability
if ! command -v docker >/dev/null 2>&1; then
printf "%bERROR%b: docker not found in PATH\n" "$RED" "$RESET" >&2
exit 2
fi
if ! docker compose version >/dev/null 2>&1; then
printf "%bERROR%b: docker compose plugin not available\n" "$RED" "$RESET" >&2
exit 2
fi
if [ ! -d "$SERVICES_DIR" ]; then
printf "%bERROR%b: services directory not found: %s\n" "$RED" "$RESET" "$SERVICES_DIR" >&2
exit 2
fi
total=0
passed=0
failed=0
validate_compose() {
local file="$1"
local extra_file="${2:-}"
if [ -n "$extra_file" ]; then
docker compose -f "$file" -f "$extra_file" config --quiet
else
docker compose -f "$file" config --quiet
fi
}
for service_dir in "${SERVICES_DIR}"/*/; do
service_name="$(basename "$service_dir")"
base_compose="${service_dir}compose.yaml"
# Skip if no compose.yaml
if [ ! -f "$base_compose" ]; then
if [ -f "${base_compose}.disabled" ]; then
printf "SKIP %s (compose.yaml.disabled)\n" "$service_name"
fi
continue
fi
# Validate base compose
total=$((total + 1))
if validate_compose "$base_compose"; then
printf "%bPASS%b %s (base)\n" "$GREEN" "$RESET" "$service_name"
passed=$((passed + 1))
else
printf "%bFAIL%b %s (base)\n" "$RED" "$RESET" "$service_name"
failed=$((failed + 1))
fi
# Validate nvidia overlay if present
nvidia_overlay="${service_dir}compose.nvidia.yaml"
if [ -f "$nvidia_overlay" ]; then
total=$((total + 1))
if validate_compose "$base_compose" "$nvidia_overlay"; then
printf "%bPASS%b %s (base + nvidia)\n" "$GREEN" "$RESET" "$service_name"
passed=$((passed + 1))
else
printf "%bFAIL%b %s (base + nvidia)\n" "$RED" "$RESET" "$service_name"
failed=$((failed + 1))
fi
fi
# Validate amd overlay if present
amd_overlay="${service_dir}compose.amd.yaml"
if [ -f "$amd_overlay" ]; then
total=$((total + 1))
if validate_compose "$base_compose" "$amd_overlay"; then
printf "%bPASS%b %s (base + amd)\n" "$GREEN" "$RESET" "$service_name"
passed=$((passed + 1))
else
printf "%bFAIL%b %s (base + amd)\n" "$RED" "$RESET" "$service_name"
failed=$((failed + 1))
fi
fi
done
printf "\n%b========================================%b\n" "$BOLD" "$RESET"
printf "Total: %d Passed: %d Failed: %d\n" "$total" "$passed" "$failed"
if [ "$failed" -gt 0 ]; then
exit 1
fi
exit 0