Rewrite Jenkinsfile
This commit is contained in:
parent
ee34e86b3b
commit
ecfc3d94cf
1 changed files with 16 additions and 19 deletions
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
|
@ -1,35 +1,32 @@
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
stages {
|
||||||
stage('Prepare') {
|
stage('Prepare') {
|
||||||
steps {
|
steps {
|
||||||
checkout([
|
git url: 'git@github.com:kemitix/condition.git',
|
||||||
$class: 'GitSCM',
|
branch: '**',
|
||||||
branches: [[name: '**']],
|
credentialsId: 'github-kemitix'
|
||||||
extensions: [[$class: 'CleanBeforeCheckout']],
|
|
||||||
userRemoteConfigs: [[credentialsId: 'github-kemitix', url: 'git@github.com:kemitix/conditional.git']]
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh './mvnw -B -U clean install'
|
maven("clean install", ".", "")
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Reporting') {
|
|
||||||
steps {
|
|
||||||
junit '**/target/surefire-reports/*.xml'
|
|
||||||
archiveArtifacts '**/target/*.jar'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when {
|
when { expression { isBranch 'master' } }
|
||||||
expression {
|
|
||||||
env.GIT_BRANCH == 'master'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh './mvnw -B -Dskip-Tests=true -P release deploy'
|
maven("deploy", allModules, "-P release")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue