-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile
43 lines (43 loc) · 1.14 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
pipeline {
agent { label 'docker' }
parameters {
string(name: 'mvn_env_opts', defaultValue: '-Xms64m -Xmx512m', description: 'Maven environment options')
string(name: 'mvn_build_opts', defaultValue: '-B -Dfrontend-build -Ddocker-build', description: 'Maven build options')
string(name: 'mvn_goals', defaultValue: 'clean verify', description: 'Maven build goals')
}
environment {
MAVEN_OPTS = "${params.mvn_env_opts}"
}
stages {
stage('Build webapp') {
steps {
sh "./mvnw ${params.mvn_build_opts} ${params.mvn_goals} -DskipTests"
}
}
stage('Run tests') {
steps {
sh "./mvnw ${params.mvn_build_opts} test"
}
post {
always {
junit 'target/surefire-reports/**/*.xml'
}
}
}
stage('Build image') {
steps {
sh "./mvnw ${params.mvn_build_opts} -Ddocker.image.tag=${BRANCH_NAME} dockerfile:build"
}
}
stage('Push image') {
steps {
sh "./mvnw ${params.mvn_build_opts} -Ddocker.image.tag=${BRANCH_NAME} dockerfile:push"
}
}
}
post {
always {
archiveArtifacts 'target/*.war'
}
}
}