-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathJenkinsfile
164 lines (152 loc) · 4.13 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
pipeline {
agent {
kubernetes {
label 'mosaic-ci-pod'
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven-sumo
image: eclipsemosaic/mosaic-ci:jdk17-sumo-1.21.0
command:
- cat
tty: true
volumeMounts:
- mountPath: "/home/jenkins/.m2/settings-security.xml"
name: "settings-security-xml"
readOnly: true
subPath: "settings-security.xml"
- mountPath: "/home/jenkins/.m2/settings.xml"
name: "settings-xml"
readOnly: true
subPath: "settings.xml"
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
- mountPath: "/opt/tools"
name: "volume-0"
readOnly: false
resources:
limits:
memory: "2Gi"
cpu: "1"
requests:
memory: "2Gi"
cpu: "1"
volumes:
- name: "settings-security-xml"
secret:
items:
- key: "settings-security.xml"
path: "settings-security.xml"
secretName: "m2-secret-dir"
- name: "settings-xml"
secret:
items:
- key: "settings.xml"
path: "settings.xml"
secretName: "m2-secret-dir"
- name: m2-repo
emptyDir: {}
- name: "volume-0"
persistentVolumeClaim:
claimName: "tools-claim-jiro-mosaic"
readOnly: true
"""
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Build') {
steps {
container('maven-sumo') {
sh 'mvn clean install -DskipTests -fae -T 4'
}
}
}
stage('Test') {
steps {
container('maven-sumo') {
sh 'mvn test -fae -T 4 -P coverage'
}
}
post {
always {
junit '**/surefire-reports/*.xml'
}
}
}
stage('Integration Tests') {
steps {
container('maven-sumo') {
sh 'mvn test -fae -P integration-tests,coverage'
}
}
post {
always {
junit 'test/**/surefire-reports/*.xml'
}
}
}
stage('Analysis') {
steps {
container('maven-sumo') {
sh 'mvn site'
}
}
post {
always {
jacoco exclusionPattern: '**/ClientServerChannelProtos*.class', skipCopyOfSrcFiles: true, sourceExclusionPattern: '**/*.*', sourceInclusionPattern: '', sourcePattern: 'x'
recordIssues(sourceCodeEncoding: 'UTF-8', tools: [
spotBugs(),
checkStyle(),
taskScanner(highTags: 'FIXME', normalTags: 'TODO', ignoreCase: true, includePattern: '**/*.java')
])
}
}
}
stage ('Deploy') {
when {
branch 'main'
}
steps {
container('maven-sumo') {
// sometimes this fails for unknown reason, so lets try it three times
retry(3) {
// requires the correct tool finding secrets
sh '/opt/tools/apache-maven/3.6.3/bin/mvn deploy -DskipTests'
}
}
}
post {
success {
archiveArtifacts artifacts: 'bundle/target/eclipse-mosaic-*.*', caseSensitive: false, onlyIfSuccessful: true
}
}
}
}
post {
success {
cleanWs()
}
fixed {
sendMail("Successful")
}
unstable {
sendMail("Unstable")
}
failure {
sendMail("Failed")
}
}
}
def sendMail(status) {
emailext(
recipientProviders: [culprits()],
subject: status + ": ${currentBuild.fullDisplayName}",
body: '${JELLY_SCRIPT, template="html-with-health-and-console"}',
mimeType: 'text/html'
)
}