-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
82 lines (70 loc) · 2.19 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
pipeline {
agent {
// run on any slave labeled as 'common'
label 'common'
}
parameters {
booleanParam(defaultValue: true,
description: 'Flag whether quality checks should be performed.',
name: 'RUN_QUALITY_CHECKS')
}
options {
skipStagesAfterUnstable()
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '28'))
timeout(time: 1, unit: 'HOURS')
}
triggers {
// at least once a day (dependencies might change over time)
cron('H H(0-7) * * *')
// check every fifteen minutes for changes
pollSCM('H/15 * * * *')
}
stages {
stage("Preparation") {
steps {
script {
currentBuild.displayName += " - ${params.RUN_QUALITY_CHECKS}"
}
}
}
stage("SCM checkout") {
steps {
deleteDir()
checkout scm
script {
pomInfo = readMavenPom file: 'pom.xml'
currentBuild.description = "${pomInfo.version}"
}
}
}
stage("CI build") {
steps {
mavenbuild uploadArtifactsWithBranchnameInVersion: true,
mavenArgs: "-DcreateChecksum=true -Dmaven.javadoc.skip=true"
}
}
stage("Quality assurance") {
when {
expression { return params.RUN_QUALITY_CHECKS }
}
steps {
sonar()
nexusPolicyEvaluation iqApplication: 'com.baloise.open.repository-template-java',
iqScanPatterns: [[scanPattern: 'target/*.jar']],
iqStage: 'build'
}
}
}
post {
always {
junit allowEmptyResults: true, testResults: '**/target/*-reports/TEST*.xml'
}
fixed {
mailTo status: "SUCCESS", actuator: true, recipients: [], logExtract: true
}
failure {
mailTo status: "FAILURE", actuator: true, recipients: [], logExtract: true
}
}
}