forked from xwiki/xwiki-platform
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
251 lines (238 loc) · 8.44 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
// It's assumed that Jenkins has been configured to implicitly load the vars/*.groovy libraries.
// Note that the version used is the one defined in Jenkins but it can be overridden as follows:
// @Library("XWiki@<branch, tag, sha1>") _
// See https://github.com/jenkinsci/workflow-cps-global-lib-plugin for details.
// Definitions of all builds
def builds = [
'Main' : {
build(
name: 'Main',
profiles: 'legacy,integration-tests,snapshotModules',
properties: '-Dxwiki.checkstyle.skip=true -Dxwiki.surefire.captureconsole.skip=true -Dxwiki.revapi.skip=true'
)
},
'Distribution' : {
build(
name: 'Distribution',
profiles: 'legacy,integration-tests,snapshotModules',
pom: 'xwiki-platform-distribution/pom.xml'
)
},
'Flavor Test - POM' : {
buildFunctionalTest(
name: 'Flavor Test - POM',
pom: 'pom.xml',
properties: '-N'
)
},
'Flavor Test - PageObjects' : {
buildFunctionalTest(
name: 'Flavor Test - PageObjects',
pom: 'xwiki-platform-distribution-flavor-test-pageobjects/pom.xml'
)
},
'Flavor Test - UI' : {
buildFunctionalTest(
name: 'Flavor Test - UI',
pom: 'xwiki-platform-distribution-flavor-test-ui/pom.xml'
)
},
'Flavor Test - Misc' : {
buildFunctionalTest(
name: 'Flavor Test - Misc',
pom: 'xwiki-platform-distribution-flavor-test-misc/pom.xml'
)
},
'Flavor Test - Storage': {
buildFunctionalTest(
name: 'Flavor Test - Storage',
pom: 'xwiki-platform-distribution-flavor-test-storage/pom.xml'
)
},
'Flavor Test - Escaping' : {
buildFunctionalTest(
name: 'Flavor Test - Escaping',
pom: 'xwiki-platform-distribution-flavor-test-escaping/pom.xml'
)
},
'Flavor Test - Selenium' : {
buildFunctionalTest(
name: 'Flavor Test - Selenium',
pom: 'xwiki-platform-distribution-flavor-test-selenium/pom.xml'
)
},
'Flavor Test - Upgrade' : {
buildFunctionalTest(
name: 'Flavor Test - Upgrade',
pom: 'xwiki-platform-distribution-flavor-test-upgrade/pom.xml'
)
},
'Flavor Test - Webstandards' : {
buildFunctionalTest(
name: 'Flavor Test - Webstandards',
pom: 'xwiki-platform-distribution-flavor-test-webstandards/pom.xml',
mavenOpts: '-Xmx2048m -Xms512m -XX:ThreadStackSize=2048'
)
},
'TestRelease': {
build(
name: 'TestRelease',
goals: 'clean install',
profiles: 'hsqldb,jetty,legacy,integration-tests,standalone,flavor-integration-tests,distribution,docker',
properties: '-DskipTests -DperformRelease=true -Dgpg.skip=true -Dxwiki.checkstyle.skip=true',
xvnc: false
)
},
'Quality' : {
build(
name: 'Quality',
// TODO call sonar:sonar when we fix the memory issue of executing that goal on platform. Right now we don't have
// enough memory on Jenkins Master for that.
// goals: 'clean install jacoco:report',
// Note: When we do so, also add:
// sonar: true
goals: 'clean install jacoco:report',
profiles: 'quality,legacy',
xvnc: false
)
}
]
stage ('Platform Builds') {
def selection = askUser(builds)
if (selection == 'All') {
buildAll(builds)
} else {
builds[selection].call()
}
}
def buildAll(builds)
{
parallel(
'main': {
// Build, skipping quality checks so that the result of the build can be sent as fast as possible to the devs.
// In addition, we want the generated artifacts to be deployed to our remote Maven repository so that developers
// can benefit from them even though some quality checks have not yet passed. In // we start a build with the
// quality profile that executes various quality checks.
//
// Note: We configure the snapshot extension repository in XWiki (-PsnapshotModules) in the generated
// distributions to make it easy for developers to install snapshot extensions when they do manual tests.
builds['Main'].call()
// Note: We want the following behavior:
// - if an error occurs during the previous build we don't want the subsequent builds to execute. This will
// happen since Jenkins will throw an exception and we don't catch it.
// - if the previous build has failures (e.g. test execution failures), we want subsequent builds to execute
// since failures can be test flickers for ex, and it could still be interesting to get a distribution to test
// xwiki manually.
// Build the distributions
builds['Distribution'].call()
// Building the various functional tests, after the distribution has been built successfully.
// Build the Flavor Test POM, required for the pageobjects module below.
builds['Flavor Test - POM'].call()
// Build the Flavor Test PageObjects required by the functional test below that need an XWiki UI
builds['Flavor Test - PageObjects'].call()
// Now run all tests in parallel
parallel(
'flavor-test-ui': {
// Run the Flavor UI tests
builds['Flavor Test - UI'].call()
},
'flavor-test-misc': {
// Run the Flavor Misc tests
builds['Flavor Test - Misc'].call()
},
'flavor-test-storage': {
// Run the Flavor Storage tests
builds['Flavor Test - Storage'].call()
},
'flavor-test-escaping': {
// Run the Flavor Escaping tests
builds['Flavor Test - Escaping'].call()
},
'flavor-test-selenium': {
// Run the Flavor Selenium tests
builds['Flavor Test - Selenium'].call()
},
'flavor-test-webstandards': {
// Run the Flavor Webstandards tests
// Note: -XX:ThreadStackSize=2048 is used to prevent a StackOverflowError error when using the HTML5 Nu
// Validator (see https://bitbucket.org/sideshowbarker/vnu/issues/4/stackoverflowerror-error-when-running)
builds['Flavor Test - Webstandards'].call()
},
'flavor-test-upgrade': {
// Run the Flavor Upgrade tests
builds['Flavor Test - Upgrade'].call()
}
)
},
'testrelease': {
// Simulate a release and verify all is fine, in preparation for the release day.
builds['TestRelease'].call()
},
'quality': {
// Run the quality checks
builds['Quality'].call()
}
)
}
def build(map)
{
node(map.node ?: '') {
// Make sure the memory dump directory exists (see below)
// Note that the user used to run the job on the agent must have the permission to create these directories
def oomPath = "/home/hudsonagent/jenkins_root/oom/maven/${env.JOB_NAME}-${currentBuild.id}"
sh "mkdir -p \"${oomPath}\""
xwikiBuild(map.name) {
// Note: we want to get a memory dump on OOM errors.
mavenOpts = map.mavenOpts ?: "-Xmx2048m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=\"${oomPath}\""
if (map.goals) {
goals = map.goals
}
if (map.profiles) {
profiles = map.profiles
}
if (map.properties) {
properties = map.properties
}
if (map.pom) {
pom = map.pom
}
if (map.mavenFlags) {
mavenFlags = map.mavenFlags
}
if (map.sonar) {
sonar = map.sonar
}
}
}
}
def buildFunctionalTest(map)
{
def sharedPOMPrefix =
'xwiki-platform-distribution/xwiki-platform-distribution-flavor/xwiki-platform-distribution-flavor-test'
build(
name: map.name,
profiles: 'legacy,integration-tests,jetty,hsqldb,firefox',
mavenOpts: map.mavenOpts,
pom: "${sharedPOMPrefix}/${map.pom}",
properties: map.properties
)
}