From cc64ad9cf6ca26dd1432c1f7b6753603e5a28801 Mon Sep 17 00:00:00 2001 From: juanjo <130799031+juanminguezsanz2023@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:09:38 +0200 Subject: [PATCH] Update Jenkinsfile --- deployments/Jenkinsfile | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/deployments/Jenkinsfile b/deployments/Jenkinsfile index bc11579..9311e33 100644 --- a/deployments/Jenkinsfile +++ b/deployments/Jenkinsfile @@ -1,24 +1,18 @@ pipeline { agent any - - environment { - // Dejamos las variables vacías aquí para que el script las rellene - CONTAINER_NAME = "" - PORT = "" - DEBUG_MODE = "" - } stages { stage('Configurar Entorno') { steps { script { + // Aquí asignamos las variables directamente al entorno global de la ejecución if (env.BRANCH_NAME == 'master') { - echo "--- ASIGNANDO VALORES DE PRODUCCIÓN ---" + echo "--- MODO PRODUCCIÓN DETECTADO ---" env.CONTAINER_NAME = "django_app_master" env.PORT = "8001" env.DEBUG_MODE = "0" - } else { - echo "--- ASIGNANDO VALORES DE DESARROLLO ---" + } else if (env.BRANCH_NAME == 'dev') { + echo "--- MODO DESARROLLO DETECTADO ---" env.CONTAINER_NAME = "django_app_dev" env.PORT = "8000" env.DEBUG_MODE = "1" @@ -32,7 +26,9 @@ pipeline { anyOf { branch 'dev'; branch 'master' } } steps { - echo "EJECUTANDO DOCKER: ${env.CONTAINER_NAME} en el puerto ${env.PORT}" + // Verificamos que ya NO sale "null" + echo "DESPLEGANDO: ${env.CONTAINER_NAME} en puerto ${env.PORT}" + sh "docker compose -f deployments/docker-compose.yml up -d --build" } }