Files
deployment-server/data/jenkins/pipelines/Jenkinsfile.sco.reports
T

81 lines
2.5 KiB
Plaintext

pipeline {
agent none
parameters {
string(
name: 'NODO',
defaultValue: '',
description: 'Nombre exacto del nodo a deployar'
)
choice(
name: 'CLIENTE',
choices: [
'SELECCIONAR_CLIENTE',
'cencosud-jumbo',
'censosud-staisabel',
'changomas-hiper',
'changomas-super',
'dibal',
'hisense',
'lsco',
'mbs-econo',
'mbs-famcoop',
'mbs-ralphs',
'mbs-supermax',
'modatelas',
'walmart-chile-acuenta',
'walmart-chile-lider',
'wm-mexico-bodega',
'wm-mexico-walmart'
],
description: 'Cliente para el cual se ejecuta el deploy'
)
string(
name: 'SUCURSAL',
defaultValue: '',
description: 'Sucursal del equipo'
)
string(
name: 'SCO_NUMBER',
defaultValue: '',
description: 'Número de SCO (ej. sco05)'
)
}
stages {
stage('Registro de parámetros') {
agent none
when { expression { params.CLIENTE == null } }
steps {
echo 'Primer build: Jenkins está registrando los parámetros de este Jenkinsfile. No se ejecuta ningún deploy. Volvé a correr el job con "Build with Parameters".'
script { currentBuild.result = 'NOT_BUILT' }
}
}
stage('Preparar scripts') {
agent { label 'built-in' }
when { expression { params.CLIENTE != null } }
steps {
sh 'cp /opt/deploy/install.sh.reports .'
stash name: 'scripts', includes: 'install.sh.reports'
}
}
stage('Deploy') {
agent { label 'built-in' }
when { expression { params.CLIENTE != null } }
steps {
script {
if (!params.NODO?.trim()) {
error "El parámetro NODO es obligatorio"
}
if (params.CLIENTE == 'SELECCIONAR_CLIENTE') {
error "El parámetro CLIENTE es obligatorio"
}
def target = params.NODO.trim()
node(target) {
unstash 'scripts'
sh "bash install.sh.reports '${params.CLIENTE.trim()}' '${params.SUCURSAL.trim()}' '${params.SCO_NUMBER.trim()}'"
}
}
}
}
}
}