workspace-v1/control-plane/devtools/scripts/validation/validate-all.sh
Adrian Flores Cortes 967ab360bb Initial commit: Workspace v1 with 3-layer architecture
Structure:
- control-plane/: Registries, SIMCO directives, CI/CD templates
- projects/: Gamilit, ERP-Suite, Trading-Platform, Betting-Analytics
- shared/: Libs catalog, knowledge-base

Key features:
- Centralized port, domain, database, and service registries
- 23 SIMCO directives + 6 fundamental principles
- NEXUS agent profiles with delegation rules
- Validation scripts for workspace integrity
- Dockerfiles for all services
- Path aliases for quick reference

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:35:19 -06:00

162 lines
5.4 KiB
Bash
Executable File

#!/bin/bash
# ==============================================================================
# validate-all.sh - Ejecuta todas las validaciones
# ==============================================================================
# Uso: ./validate-all.sh [directorio-repos]
# ==============================================================================
set -e
# Colores
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
# Rutas
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONTROL_PLANE="${SCRIPT_DIR}/../../.."
REPOS_DIR="${1:-${CONTROL_PLANE}/../projects}"
echo -e "${BLUE}============================================${NC}"
echo -e "${BLUE} VALIDACION COMPLETA DEL WORKSPACE${NC}"
echo -e "${BLUE}============================================${NC}"
echo ""
echo "Control Plane: $CONTROL_PLANE"
echo "Repos: $REPOS_DIR"
echo ""
TOTAL_ERRORS=0
# ------------------------------------------------------------------------------
# 1. Validar estructura del Control Plane
# ------------------------------------------------------------------------------
echo -e "${YELLOW}[1/5] Validando estructura del Control Plane...${NC}"
REQUIRED_DIRS=(
"orchestration"
"registries"
"manifests"
"devtools"
)
for dir in "${REQUIRED_DIRS[@]}"; do
if [ -d "$CONTROL_PLANE/$dir" ]; then
echo -e " ${GREEN}[OK]${NC} $dir/"
else
echo -e " ${RED}[FAIL]${NC} $dir/ no existe"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
done
# ------------------------------------------------------------------------------
# 2. Validar registries (YAML valido)
# ------------------------------------------------------------------------------
echo ""
echo -e "${YELLOW}[2/5] Validando registries...${NC}"
REGISTRY_FILES=(
"registries/ports.registry.yml"
"registries/domains.registry.yml"
"registries/databases.registry.yml"
)
for file in "${REGISTRY_FILES[@]}"; do
if [ -f "$CONTROL_PLANE/$file" ]; then
if python3 -c "import yaml; yaml.safe_load(open('$CONTROL_PLANE/$file'))" 2>/dev/null; then
echo -e " ${GREEN}[OK]${NC} $file (YAML valido)"
else
echo -e " ${RED}[FAIL]${NC} $file (YAML invalido)"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
else
echo -e " ${RED}[FAIL]${NC} $file no existe"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
done
# ------------------------------------------------------------------------------
# 3. Validar manifests
# ------------------------------------------------------------------------------
echo ""
echo -e "${YELLOW}[3/5] Validando manifests...${NC}"
MANIFEST_FILES=(
"manifests/repos.manifest.yml"
"manifests/environments.manifest.yml"
)
for file in "${MANIFEST_FILES[@]}"; do
if [ -f "$CONTROL_PLANE/$file" ]; then
if python3 -c "import yaml; yaml.safe_load(open('$CONTROL_PLANE/$file'))" 2>/dev/null; then
echo -e " ${GREEN}[OK]${NC} $file"
else
echo -e " ${RED}[FAIL]${NC} $file (YAML invalido)"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
else
echo -e " ${RED}[FAIL]${NC} $file no existe"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
done
# ------------------------------------------------------------------------------
# 4. Validar puertos
# ------------------------------------------------------------------------------
echo ""
echo -e "${YELLOW}[4/5] Validando puertos...${NC}"
if [ -x "$SCRIPT_DIR/validate-ports.sh" ]; then
if "$SCRIPT_DIR/validate-ports.sh" "$REPOS_DIR" 2>/dev/null; then
echo -e " ${GREEN}[OK]${NC} Validacion de puertos exitosa"
else
echo -e " ${RED}[FAIL]${NC} Validacion de puertos fallida"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
else
echo -e " ${YELLOW}[SKIP]${NC} validate-ports.sh no es ejecutable"
fi
# ------------------------------------------------------------------------------
# 5. Validar service descriptors
# ------------------------------------------------------------------------------
echo ""
echo -e "${YELLOW}[5/5] Validando service descriptors...${NC}"
if [ -d "$REPOS_DIR" ]; then
if [ -x "$SCRIPT_DIR/validate-service-descriptors.sh" ]; then
for project_dir in "$REPOS_DIR"/*/; do
if [ -d "$project_dir" ]; then
project_name=$(basename "$project_dir")
echo " Validando proyecto: $project_name"
if "$SCRIPT_DIR/validate-service-descriptors.sh" "$project_dir" 2>/dev/null; then
echo -e " ${GREEN}[OK]${NC}"
else
echo -e " ${RED}[FAIL]${NC}"
TOTAL_ERRORS=$((TOTAL_ERRORS + 1))
fi
fi
done
else
echo -e " ${YELLOW}[SKIP]${NC} validate-service-descriptors.sh no es ejecutable"
fi
else
echo -e " ${YELLOW}[SKIP]${NC} Directorio de repos no existe: $REPOS_DIR"
fi
# ------------------------------------------------------------------------------
# Resultado final
# ------------------------------------------------------------------------------
echo ""
echo -e "${BLUE}============================================${NC}"
if [ $TOTAL_ERRORS -eq 0 ]; then
echo -e "${GREEN} TODAS LAS VALIDACIONES EXITOSAS${NC}"
echo -e "${BLUE}============================================${NC}"
exit 0
else
echo -e "${RED} VALIDACION FALLIDA: $TOTAL_ERRORS errores${NC}"
echo -e "${BLUE}============================================${NC}"
exit 1
fi