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
102 lines
3.2 KiB
Bash
Executable File
102 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# ==============================================================================
|
|
# VALIDATE DOMAINS - Control Plane
|
|
# ==============================================================================
|
|
# Proposito: Validar que dominios en service descriptors coincidan con registry
|
|
# Mantenido por: DevOps-Agent
|
|
# ==============================================================================
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
CONTROL_PLANE="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
WORKSPACE="$(cd "$CONTROL_PLANE/.." && pwd)"
|
|
DOMAINS_REGISTRY="$CONTROL_PLANE/registries/domains.registry.yml"
|
|
|
|
# Colores
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
echo "=============================================="
|
|
echo " VALIDACION DE DOMINIOS"
|
|
echo "=============================================="
|
|
echo ""
|
|
|
|
# Verificar que existe domains.registry.yml
|
|
if [ ! -f "$DOMAINS_REGISTRY" ]; then
|
|
echo -e "${RED}[ERROR]${NC} No existe domains.registry.yml"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}[OK]${NC} domains.registry.yml encontrado"
|
|
echo ""
|
|
|
|
# Verificar YAML valido
|
|
if command -v python3 &> /dev/null; then
|
|
if python3 -c "import yaml; yaml.safe_load(open('$DOMAINS_REGISTRY'))" 2>/dev/null; then
|
|
echo -e "${GREEN}[OK]${NC} YAML valido"
|
|
else
|
|
echo -e "${RED}[ERROR]${NC} domains.registry.yml no es YAML valido"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo -e "${YELLOW}[WARN]${NC} python3 no disponible, saltando validacion YAML"
|
|
fi
|
|
|
|
# Contar proyectos con dominios definidos
|
|
echo ""
|
|
echo "--- Proyectos con dominios ---"
|
|
|
|
PROJECTS=$(grep -E "^ [a-z_]+:" "$DOMAINS_REGISTRY" | grep -v "local:" | grep -v "development:" | grep -v "staging:" | grep -v "production:" | grep -v "api:" | grep -v "web:" | grep -v "admin:" | head -20 || true)
|
|
|
|
if [ -n "$PROJECTS" ]; then
|
|
echo "$PROJECTS" | while read -r line; do
|
|
PROJECT=$(echo "$line" | sed 's/://g' | xargs)
|
|
if [ -n "$PROJECT" ] && [ "$PROJECT" != "environments" ]; then
|
|
echo -e " ${GREEN}*${NC} $PROJECT"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Verificar service descriptors referencian dominios validos
|
|
echo ""
|
|
echo "--- Validando Service Descriptors ---"
|
|
|
|
ERRORS=0
|
|
WARNINGS=0
|
|
|
|
find "$WORKSPACE/projects" -name "service.descriptor.yml" 2>/dev/null | while read -r descriptor; do
|
|
REL_PATH=$(echo "$descriptor" | sed "s|$WORKSPACE/||")
|
|
|
|
# Verificar que tiene domain definido
|
|
if grep -q "domain:" "$descriptor" 2>/dev/null; then
|
|
DOMAIN=$(grep "domain:" "$descriptor" | head -1 | awk '{print $2}' | tr -d '"')
|
|
|
|
# Verificar que el dominio esta en el registry
|
|
if grep -q "$DOMAIN" "$DOMAINS_REGISTRY" 2>/dev/null; then
|
|
echo -e " ${GREEN}[OK]${NC} $REL_PATH -> $DOMAIN"
|
|
else
|
|
echo -e " ${YELLOW}[WARN]${NC} $REL_PATH -> $DOMAIN (no en registry)"
|
|
((WARNINGS++)) || true
|
|
fi
|
|
else
|
|
echo -e " ${YELLOW}[INFO]${NC} $REL_PATH (sin domain definido)"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "=============================================="
|
|
|
|
if [ $ERRORS -gt 0 ]; then
|
|
echo -e "${RED}VALIDACION FALLIDA${NC} - $ERRORS errores encontrados"
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}VALIDACION EXITOSA${NC}"
|
|
if [ $WARNINGS -gt 0 ]; then
|
|
echo -e "${YELLOW}$WARNINGS advertencias${NC}"
|
|
fi
|
|
exit 0
|
|
fi
|