conditional/Jenkinsfile

34 lines
784 B
Text
Raw Normal View History

2018-02-26 21:06:12 +00:00
def maven(goals, modules, profiles) {
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
sh "mvn -U $profiles $modules $goals"
}
}
def isBranch(branch) {
return env.GIT_BRANCH == branch
}
2018-02-22 22:37:51 +00:00
pipeline {
agent any
stages {
2018-02-24 20:50:21 +00:00
stage('Prepare') {
2018-02-22 22:37:51 +00:00
steps {
2018-02-26 21:06:12 +00:00
git url: 'git@github.com:kemitix/condition.git',
branch: '**',
credentialsId: 'github-kemitix'
2018-02-24 20:50:21 +00:00
}
}
stage('Build') {
steps {
2018-02-26 21:06:12 +00:00
maven("clean install", ".", "")
2018-02-22 22:37:51 +00:00
}
}
stage('Deploy') {
2018-02-26 21:06:12 +00:00
when { expression { isBranch 'master' } }
steps {
2018-02-26 21:06:12 +00:00
maven("deploy", allModules, "-P release")
}
}
2018-02-22 22:37:51 +00:00
}
}