-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
60 lines (46 loc) · 1.47 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
#!/groovy
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '10', numToKeepStr: '10']],
disableConcurrentBuilds()
]
node {
env.JAVA_HOME = tool 'jdk-8-oracle'
env.PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
def err = null
def mvnOpts = "-V -U --batch-mode"
currentBuild.result = "SUCCESS"
timestamps {
try {
stage('Checkout project') {
checkout scm
sh "chmod 755 ./mvnw"
}
stage('Build') {
sh "./mvnw clean install ${mvnOpts}"
}
stage('I-Test') {
sh "./mvnw integration-test -Pitest ${mvnOpts}"
try {
// check if there were errors
sh "./mvnw failsafe:verify ${mvnOpts}"
} catch (buildError) {
// set status to unstable, if errors found
currentBuild.result = "UNSTABLE"
}
}
} catch (caughtError) {
err = caughtError
currentBuild.result = "FAILURE"
} finally {
// collect coverage
step([$class: 'JacocoPublisher'])
// collect unit
step([$class: 'JUnitResultArchiver', allowEmptyResults: true, testResults: '**/target/*-reports/TEST-*.xml'])
cleanWs cleanWhenSuccess: false, cleanWhenUnstable: false
/* Must re-throw exception to propagate error */
if (err) {
throw err
}
} // finally
} // timestamps
}