Sistema NEXUS v3.4 migrado con: Estructura principal: - core/orchestration: Sistema SIMCO + CAPVED (27 directivas, 28 perfiles) - core/catalog: Catalogo de funcionalidades reutilizables - shared/knowledge-base: Base de conocimiento compartida - devtools/scripts: Herramientas de desarrollo - control-plane/registries: Control de servicios y CI/CD - orchestration/: Configuracion de orquestacion de agentes Proyectos incluidos (11): - gamilit (submodule -> GitHub) - trading-platform (OrbiquanTIA) - erp-suite con 5 verticales: - erp-core, construccion, vidrio-templado - mecanicas-diesel, retail, clinicas - betting-analytics - inmobiliaria-analytics - platform_marketing_content - pos-micro, erp-basico Configuracion: - .gitignore completo para Node.js/Python/Docker - gamilit como submodule (git@github.com:rckrdmrd/gamilit-workspace.git) - Sistema de puertos estandarizado (3005-3199) Generated with NEXUS v3.4 Migration System EPIC-010: Configuracion Git y Repositorios
162 lines
5.4 KiB
Bash
Executable File
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
|