forked from eclipse/mosaic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
180 lines (168 loc) · 4.91 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
pipeline {
agent {
kubernetes {
label 'mosaic-ci-pod'
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven-sumo
image: eclipsemosaic/mosaic-ci:jdk8-sumo-1.12.0
command:
- cat
tty: true
volumeMounts:
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
resources:
limits:
memory: "2Gi"
cpu: "1"
requests:
memory: "2Gi"
cpu: "1"
- name: jnlp
image: 'eclipsecbijenkins/basic-agent:3.35'
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 -T 4'
}
}
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('jnlp') {
// it's not possible to deploy from the maven-sumo container, as there's something wrong in
// finding .m2/settings.xml and .m2/repository even if mounted. executing mvn -X prints
// some weird paths:
// > [DEBUG] Reading user settings from ?/.m2/settings.xml
// which makes it impossible to mount the correct settings.xml
// Therefore we are using a second container which is able to read the mounted settings.xml and is able to
// deploy the artifacts. The only drawback is, that this step again builds all artifacts.
sh '/opt/tools/apache-maven/3.6.3/bin/mvn install -DskipTests'
sh '/opt/tools/apache-maven/3.6.3/bin/mvn deploy -DskipTests'
}
}
post {
success {
archiveArtifacts artifacts: 'bundle/target/eclipse-mosaic-*.zip', 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'
)
}