Parametrize configurations¡

This commit is contained in:
2025-12-24 12:44:34 +01:00
parent a2f21e1286
commit a9baf6da95
8 changed files with 105 additions and 30 deletions

View File

@@ -5,10 +5,31 @@ pipeline {
timestamps()
}
parameters {
string(
name: 'JENKINS_BASE_URL',
defaultValue: 'https://openbokeron.org/jenkins',
description: 'Base URL del Jenkins objetivo'
)
string(
name: 'JENKINS_JOB_NAME',
defaultValue: 'TallerCiCd',
description: 'Nombre del job que se consulta en Jenkins'
)
string(
name: 'VITE_API_BASE',
defaultValue: '/taller/api',
description: 'Base path/API para el frontend (build time)'
)
}
environment {
NODE_OPTIONS = '--max_old_space_size=2048'
APP_VERSION = "1.0.${BUILD_NUMBER}"
DOCKER_BUILDKIT = '1'
JENKINS_BASE_URL = "${params.JENKINS_BASE_URL}"
JENKINS_JOB_NAME = "${params.JENKINS_JOB_NAME}"
VITE_API_BASE = "${params.VITE_API_BASE}"
}
stages {
@@ -77,6 +98,7 @@ pipeline {
./backend
docker build \
--build-arg VITE_API_BASE=${VITE_API_BASE} \
-t cafeteria-frontend:${BUILD_NUMBER} \
-t cafeteria-frontend:latest \
./frontend
@@ -93,10 +115,6 @@ pipeline {
branch 'main'
}
agent any
environment {
JENKINS_BASE_URL = 'https://openbokeron.org/jenkins'
JENKINS_JOB_NAME = 'TallerCiCd'
}
steps {
withCredentials([
usernamePassword(
@@ -110,15 +128,14 @@ pipeline {
echo "Deploying backend ${BUILD_NUMBER}"
echo "BACKEND_TAG=${BUILD_NUMBER}" > .env
echo "FRONTEND_TAG=${BUILD_NUMBER}" >> .env
docker-compose up -d
BACKEND_TAG=${BUILD_NUMBER} FRONTEND_TAG=${BUILD_NUMBER} docker-compose up -d
'''
}
}
}
stage('Cleanup') {
agent any
steps {