This repository has been archived by the owner on Oct 13, 2020. It is now read-only.
forked from jenkinsci/git-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
52 lines (41 loc) · 1.46 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
#!groovy
/* Only keep the 10 most recent builds. */
properties([[$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']]])
node {
stage 'Checkout'
checkout scm
stage 'Build'
/* Call the maven build. */
mvn "clean install -B -V -U -e -Dsurefire.useFile=false -Dmaven.test.failure.ignore=true"
/* Save Results. */
stage 'Results'
/* Archive the test results */
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
/* Archive the build artifacts */
step([$class: 'ArtifactArchiver', artifacts: 'target/*.hpi,target/*.jpi'])
}
/* Run maven from tool "mvn" */
void mvn(def args) {
/* Get jdk tool. */
String jdktool = tool name: "jdk7", type: 'hudson.model.JDK'
/* 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}",
// Additional variables needed by tests on machines
// that don't have global git user.name and user.email configured.
'GIT_COMMITTER_EMAIL=me@hatescake.com','GIT_COMMITTER_NAME=Hates','GIT_AUTHOR_NAME=Cake','GIT_AUTHOR_EMAIL=hates@cake.com', 'LOGNAME=hatescake'
]
/* 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}"
}
}
}
}