Files
java-maven-app/Jenkinsfile
2020-11-06 08:33:33 +00:00

54 lines
1.4 KiB
Groovy

def gv
pipeline {
agent any
parameters {
choice(name: 'VERSION', choices: ['1.1.0', '1.2.0', '1.3.0'], description: '')
booleanParam(name: 'executeTests', defaultValue: true, description: '')
}
stages {
stage("init") {
steps {
script {
gv = load "script.groovy"
}
}
}
stage("build") {
steps {
script {
gv.buildApp()
}
}
}
stage("test") {
when {
expression {
params.executeTests
}
}
steps {
script {
gv.testApp()
}
}
}
stage("deploy") {
input {
message "Select the environment to deploy to"
ok "Done"
parameters {
choice(name: 'ENV-ONE', choices: ['dev', 'staging', 'prod'], description: '')
choice(name: 'ENV-TWO', choices: ['dev', 'staging', 'prod'], description: '')
}
}
steps {
script {
gv.deployApp()
echo "Deploying to ${ENV-ONE}"
echo "Deploying to ${ENV-TWO}"
}
}
}
}
}