Merge pull request 'Update Jenkinsfile' (#4) from pre-dev into dev

Reviewed-on: https://gitea.185.187.169.109.nip.io/Proyecto-SaaS/django-core-base/pulls/4
This commit is contained in:
2026-04-11 15:05:48 +02:00

View File

@@ -2,10 +2,10 @@ pipeline {
agent any agent any
environment { environment {
// Valores iniciales por seguridad // Dejamos las variables vacías aquí para que el script las rellene
CONTAINER_NAME = "django_app_dev" CONTAINER_NAME = ""
PORT = "8000" PORT = ""
DEBUG_MODE = "1" DEBUG_MODE = ""
} }
stages { stages {
@@ -13,12 +13,12 @@ pipeline {
steps { steps {
script { script {
if (env.BRANCH_NAME == 'master') { if (env.BRANCH_NAME == 'master') {
echo "--- CONFIGURANDO MODO PRODUCCIÓN (MASTER) ---" echo "--- ASIGNANDO VALORES DE PRODUCCIÓN ---"
env.CONTAINER_NAME = "django_app_master" env.CONTAINER_NAME = "django_app_master"
env.PORT = "8001" env.PORT = "8001"
env.DEBUG_MODE = "0" env.DEBUG_MODE = "0"
} else if (env.BRANCH_NAME == 'dev') { } else {
echo "--- CONFIGURANDO MODO DESARROLLO (DEV) ---" echo "--- ASIGNANDO VALORES DE DESARROLLO ---"
env.CONTAINER_NAME = "django_app_dev" env.CONTAINER_NAME = "django_app_dev"
env.PORT = "8000" env.PORT = "8000"
env.DEBUG_MODE = "1" env.DEBUG_MODE = "1"
@@ -32,8 +32,7 @@ pipeline {
anyOf { branch 'dev'; branch 'master' } anyOf { branch 'dev'; branch 'master' }
} }
steps { steps {
echo "Desplegando contenedor: ${env.CONTAINER_NAME} en puerto: ${env.PORT}" echo "EJECUTANDO DOCKER: ${env.CONTAINER_NAME} en el puerto ${env.PORT}"
// Ahora Docker Compose sí recibirá los valores correctamente
sh "docker compose -f deployments/docker-compose.yml up -d --build" sh "docker compose -f deployments/docker-compose.yml up -d --build"
} }
} }