#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" COMPOSE_DIR="$ROOT_DIR/compose" HELM_DIR="$ROOT_DIR/helm/stellaops" compose_profiles=( "docker-compose.dev.yaml:env/dev.env.example" "docker-compose.stage.yaml:env/stage.env.example" "docker-compose.airgap.yaml:env/airgap.env.example" ) docker_ready=false if command -v docker >/dev/null 2>&1; then if docker compose version >/dev/null 2>&1; then docker_ready=true else echo "⚠️ docker CLI present but Compose plugin unavailable; skipping compose validation" >&2 fi else echo "⚠️ docker CLI not found; skipping compose validation" >&2 fi if [[ "$docker_ready" == "true" ]]; then for entry in "${compose_profiles[@]}"; do IFS=":" read -r compose_file env_file <<<"$entry" printf '→ validating %s with %s\n' "$compose_file" "$env_file" docker compose \ --env-file "$COMPOSE_DIR/$env_file" \ -f "$COMPOSE_DIR/$compose_file" config >/dev/null done fi helm_values=( "$HELM_DIR/values-dev.yaml" "$HELM_DIR/values-stage.yaml" "$HELM_DIR/values-airgap.yaml" ) if command -v helm >/dev/null 2>&1; then for values in "${helm_values[@]}"; do printf '→ linting Helm chart with %s\n' "$(basename "$values")" helm lint "$HELM_DIR" -f "$values" helm template test-release "$HELM_DIR" -f "$values" >/dev/null done else echo "⚠️ helm CLI not found; skipping Helm lint/template" >&2 fi printf 'Profiles validated (where tooling was available).\n'