Files
light-heart-labs--dreamserver/ods/lib/validate-dependencies.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

59 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# validate-dependencies.sh - Service dependency validation
# Part of: lib/
# Purpose: Validate service dependencies before compose up
#
# Expects: SERVICE_IDS, SERVICE_DEPENDS, SERVICE_COMPOSE (from service-registry.sh)
# Provides: validate_service_dependencies()
# Validate that all service dependencies are satisfied
# Returns 0 if all dependencies are met, 1 if any are missing
validate_service_dependencies() {
local errors=0
local warnings=0
# Build list of enabled services (have compose files)
local -A enabled_services
for sid in "${SERVICE_IDS[@]}"; do
local cf="${SERVICE_COMPOSE[$sid]}"
if [[ -n "$cf" && -f "$cf" ]]; then
enabled_services[$sid]=1
fi
done
# Core services defined in docker-compose.base.yml are always enabled
# (they have no extension manifest, so the registry does not know about them)
local _base_compose="${INSTALL_DIR:-$SCRIPT_DIR}/docker-compose.base.yml"
if [[ -f "$_base_compose" ]]; then
local _svc
while IFS= read -r _svc; do
enabled_services[$_svc]=1
done < <(sed -n 's/^ \([a-z][a-z0-9_-]*\):.*/\1/p' "$_base_compose" 2>/dev/null)
fi
# Check each enabled service's dependencies
for sid in "${SERVICE_IDS[@]}"; do
[[ -z "${enabled_services[$sid]:-}" ]] && continue
local deps="${SERVICE_DEPENDS[$sid]:-}"
[[ -z "$deps" ]] && continue
# Parse space-separated dependency list
for dep in $deps; do
if [[ -z "${enabled_services[$dep]:-}" ]]; then
echo "ERROR: Service '$sid' depends on '$dep', but '$dep' is not enabled" >&2
errors=$((errors + 1))
fi
done
done
if [[ $errors -gt 0 ]]; then
echo "" >&2
echo "Dependency validation failed: $errors missing dependencies" >&2
echo "Fix by enabling required services or disabling dependent services" >&2
return 1
fi
return 0
}