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
143 lines
4.1 KiB
Plaintext
143 lines
4.1 KiB
Plaintext
// =============================================================================
|
|
// Jenkinsfile - Frontend Web
|
|
// ERP Suite - React + Vite + TypeScript
|
|
// =============================================================================
|
|
|
|
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
// Configuración del proyecto
|
|
PROJECT_NAME = 'erp-construccion-frontend-web'
|
|
DOCKER_REGISTRY = 'registry.isem.digital'
|
|
DOCKER_IMAGE = "${DOCKER_REGISTRY}/${PROJECT_NAME}"
|
|
DOCKER_TAG = "${BUILD_NUMBER}"
|
|
|
|
// Configuración de Kubernetes
|
|
K8S_NAMESPACE = 'erp-production'
|
|
K8S_DEPLOYMENT = "${PROJECT_NAME}"
|
|
|
|
// Node.js
|
|
NODE_ENV = 'production'
|
|
}
|
|
|
|
options {
|
|
timeout(time: 20, unit: 'MINUTES')
|
|
disableConcurrentBuilds()
|
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
|
|
stage('Install Dependencies') {
|
|
steps {
|
|
sh 'npm ci'
|
|
}
|
|
}
|
|
|
|
stage('Lint') {
|
|
steps {
|
|
sh 'npm run lint'
|
|
}
|
|
}
|
|
|
|
stage('Type Check') {
|
|
steps {
|
|
sh 'npm run type-check'
|
|
}
|
|
}
|
|
|
|
stage('Build') {
|
|
steps {
|
|
// Inyectar variables de entorno de producción
|
|
withCredentials([
|
|
string(credentialsId: 'api-url-production', variable: 'VITE_API_URL')
|
|
]) {
|
|
sh 'npm run build'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Docker Build') {
|
|
steps {
|
|
script {
|
|
docker.build("${DOCKER_IMAGE}:${DOCKER_TAG}", ".")
|
|
docker.build("${DOCKER_IMAGE}:latest", ".")
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Docker Push') {
|
|
steps {
|
|
script {
|
|
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-credentials') {
|
|
docker.image("${DOCKER_IMAGE}:${DOCKER_TAG}").push()
|
|
docker.image("${DOCKER_IMAGE}:latest").push()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Deploy to Kubernetes') {
|
|
when {
|
|
branch 'main'
|
|
}
|
|
steps {
|
|
withKubeConfig([credentialsId: 'k8s-credentials', namespace: "${K8S_NAMESPACE}"]) {
|
|
sh """
|
|
kubectl set image deployment/${K8S_DEPLOYMENT} \
|
|
${K8S_DEPLOYMENT}=${DOCKER_IMAGE}:${DOCKER_TAG} \
|
|
-n ${K8S_NAMESPACE}
|
|
kubectl rollout status deployment/${K8S_DEPLOYMENT} \
|
|
-n ${K8S_NAMESPACE} \
|
|
--timeout=180s
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Invalidate CDN Cache') {
|
|
when {
|
|
branch 'main'
|
|
}
|
|
steps {
|
|
// Ejemplo con CloudFlare
|
|
withCredentials([
|
|
string(credentialsId: 'cloudflare-api-token', variable: 'CF_TOKEN'),
|
|
string(credentialsId: 'cloudflare-zone-id', variable: 'CF_ZONE')
|
|
]) {
|
|
sh """
|
|
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CF_ZONE}/purge_cache" \
|
|
-H "Authorization: Bearer ${CF_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
--data '{"purge_everything":true}'
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
slackSend(
|
|
color: 'good',
|
|
message: "✅ Frontend deployed: ${PROJECT_NAME} v${BUILD_NUMBER}"
|
|
)
|
|
}
|
|
failure {
|
|
slackSend(
|
|
color: 'danger',
|
|
message: "❌ Frontend build failed: ${PROJECT_NAME}"
|
|
)
|
|
}
|
|
always {
|
|
cleanWs()
|
|
}
|
|
}
|
|
}
|