Update Jenkinsfile
This commit is contained in:
18
deployments/Jenkinsfile
vendored
18
deployments/Jenkinsfile
vendored
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user