forked from queoGmbH/java-queo-commons-persistence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile_NormalBuild
72 lines (64 loc) · 2.5 KB
/
Jenkinsfile_NormalBuild
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
#!groovy
pipeline {
// define a jenkins agent with a globally configured docker agent template labeled 'docker-slave', which also has the docker cloud configuration
agent { node { label 'docker-slave' } }
environment {
// installing the globally defined tools in every node that is used, referenced by their labels
JAVA_HOME = "${tool 'openJDK_11'}"
M2_HOME = "${tool 'maven_3.6.0'}"
PATH = "${PATH}" + ":${M2_HOME}/bin" + ":${JAVA_HOME}/bin"
// does not enable the start of local containers, the docker cli is used for remote access
DOCKER_PATH = "${tool 'docker_latest'}"
buildSuccessful = false
}
stages {
stage('Prepare') { // fail > failure
steps {
checkout scm
script {
// loading our custom lib
lib = load 'jenkins.lib'
lib.setJobProperties()
}
}
}
stage('Build Test') { // fail > failure
steps {
script {
lib.printBuildResult()
try {
sh " mvn clean install " +
" -DskipITs " +
" -PQueoCIServer,JaCoCo " +
" -Dbuildtime.output.log=true " +
" -Dbuildtime.output.csv=true " +
" -Dbuildtime.output.csv.file=mvnBuildPerformanceLog.csv " +
" -Dbuildnode.name=jenkinsjava_${EXECUTOR_NUMBER} "
buildSuccessful = true
} catch (exception) {
lib.setToFailure()
lib.printStackTrace(exception)
}
lib.printBuildResult()
}
}
}
stage('Results') { // fail > unstable
steps {
script {
lib.printBuildResult()
try {
lib.publishToDos()
//lib.publishHtmlReports() - disable because there is no 'maven site' stage that generate any html
lib.publishXunitReports()
lib.notifyViaMail()
} catch (exception) {
lib.setToUnstable()
lib.printStackTrace(exception)
}
lib.printBuildResult()
}
}
}
}
}