-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
87 lines (77 loc) · 2.63 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
pipeline {
agent any
parameters {
string(name: 'RELEASE_TAG', defaultValue: '', description: 'The Github release tag to deploy')
string(name: 'NEW_VERSION', defaultValue: '', description: 'The new version to be released to the maven repository e.g. 1.0.5')
}
environment {
integration_test_config = credentials('enav-services-integration-test.properties')
}
tools {
maven 'M3.3.9'
}
triggers {
pollSCM('* * * * *')
cron('H * * * *')
}
stages {
stage ('prepare') {
steps {
sh "java -version"
echo "${currentBuild.buildCauses}"
}
}
stage('build') {
when {
expression {currentBuild.buildCauses.toString().contains("SCM")}
}
steps {
withMaven(maven: 'M3.3.9', mavenOpts: '-Xmx1024m') {
sh 'mvn -U clean checkstyle:check source:jar install'
}
}
post {
success {
echo "TODO deploy to snapshot repo"
}
}
}
stage('integration test') {
when {
expression {currentBuild.buildCauses.toString().contains("Started by timer")}
}
steps {
withMaven(maven: 'M3.3.9', mavenOpts: '-Xmx1024m ') {
sh "mvn -Denav-services-integration-test.configuration=file://${integration_test_config} clean test -PintegrationTest -Dmaven.node.skip=true"
}
}
}
stage('release') {
when {
expression { params.RELEASE_TAG != '' }
}
steps {
withMaven(maven: 'M3.5.0', mavenOpts: '-Xmx1024m ') {
sh "mvn versions:set -DnewVersion=${params.NEW_VERSION}"
sh "mvn versions:update-property -DnewVersion=[${params.NEW_VERSION}] -Dproperty=enav-services.version"
}
withMaven(maven: 'M3.3.9', mavenOpts: '-Xmx1024m ') {
sh "mvn -U clean checkstyle:check source:jar install"
}
}
post {
success {
echo "TODO deploy to release repo"
}
}
}
}
post {
failure {
// notify users when the Pipeline fails
mail to: 'steen@lundogbendsen.dk,rmj@dma.dk',
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}