-
Notifications
You must be signed in to change notification settings - Fork 29
/
Jenkinsfile
50 lines (38 loc) · 1.24 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
#!/usr/bin/env groovy
/* Only keep the 20 most recent builds */
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '20']]])
node {
stage 'Checkout'
checkout scm
stage 'Build'
/* Call the maven build */
mvn 'clean install -B -V'
stage 'Build extended'
/* Call the maven build again, that will trigger additional tests */
mvn 'clean install -B -V -Djenkins.version=1.580.1 -Djava.level=8 -Dworkflow-step-api.version=2.3 -Dworkflow-support.version=2.2 -Dworkflow-job.version=2.4 -Dworkflow-basic-steps.version=2.1 -Dworkflow-cps.version=2.10'
/* Save Results */
stage 'Results'
/* Archive the test results */
junit '**/target/surefire-reports/TEST-*.xml'
}
/* Run maven from tool 'mvn' */
void mvn(def args) {
/* Get jdk tool */
String jdktool = tool 'jdk8'
/* Get the maven tool */
def mvnHome = tool name: 'mvn'
/* Set JAVA_HOME, and special PATH variables */
List javaEnv = [
"PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}"
]
/* Call maven tool with java envVars */
withEnv(javaEnv) {
timeout(time: 60, unit: 'MINUTES') {
if (isUnix()) {
sh "${mvnHome}/bin/mvn ${args}"
} else {
bat "${mvnHome}\\bin\\mvn ${args}"
}
}
}
}