Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 35 additions & 13 deletions vars/ejecucion.groovy
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
def call(){

pipeline {
agent any

parameters {
choice(name: 'buildtool', choices: ['gradle','maven'], description: 'Elección de herramienta de construcción para aplicación covid')
string(name: 'stages', defaultValue: '' , description: 'Escribir stages a ejecutar en formato: stage1;stage2;stage3. Si stage es vacío, se ejecutarán todos los stages.')
}
choice(name: 'buildtool', choices: ['gradle','maven'], description: 'Elección de herramienta')
[$class: 'CascadeChoiceParameter',
choiceType: 'RADIO',
description: 'Stages',
filterLength: 1,
filterable: false,
name: 'stages',
randomName: 'choice-parameter-5631314456178619',
referencedParameters: 'buildtool',
script: [
$class: 'GroovyScript',
script: [
classpath: [],
sandbox: true,
script:
'''
def maven = ['compile','test','jar','runJar','sonar','nexus']
def gradle = ['buildAndTest','sonar','runJar','rest','nexus']

if (buildtool == 'gradle'){
return gradle
} else {
return maven
}
'''
]
]
]
}
stages {
stage('Pipeline') {
steps {
script{
println 'Herramienta de ejecución seleccionada: ' + params.buildtool

if (params.buildtool == 'gradle'){
gradle "${params.stages}"
} else {
maven "${params.stages}"
figlet params.buildtool
stages.split(',').each{
try{
"${params.buildtool.it}"()
}catch (Exception e){
error "Error en stage ${it}: ${e}"
}
}

}
}
}
}
}

}

return this;