/
html-with-health-builds-tests.jelly
553 lines (541 loc) · 18.2 KB
/
html-with-health-builds-tests.jelly
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<html>
<head>
<title>${project.name}</title>
<style>
body table, td, th, p, h1, h2 {
margin:0;
font:normal normal 100% Georgia, Serif;
background-color: #ffffff;
}
h1, h2 {
border-bottom:dotted 1px #999999;
padding:5px;
margin-top:10px;
margin-bottom:10px;
color: #000000;
font: normal bold 130% Georgia,Serif;
background-color:#f0f0f0;
}
tr.gray {
background-color:#f0f0f0;
}
h2 {
padding:5px;
margin-top:5px;
margin-bottom:5px;
font: italic bold 110% Georgia,Serif;
}
.bg2 {
color:black;
background-color:#E0E0E0;
font-size:110%
}
th {
font-weight: bold;
}
tr, td, th {
padding:2px;
}
td.test_passed {
color:blue;
}
td.test_failed {
color:red;
}
td.test_skipped {
color:grey;
}
.console {
font: normal normal 90% Courier New, monotype;
padding:0px;
margin:0px;
}
div.content, div.header {
background: #ffffff;
border: dotted
1px #666;
margin: 2px;
content: 2px;
padding: 2px;
}
table.border, th.border, td.border {
border: 1px solid black;
border-collapse:collapse;
}
</style>
</head>
<body>
<div class="header">
<j:set var="spc" value="&nbsp;&nbsp;" />
<!-- GENERAL INFO -->
<table>
<tr class="gray">
<td align="right">
<j:choose>
<j:when test="${build.result=='SUCCESS'}">
<img src="${rooturl}static/e59dfe28/images/32x32/blue.gif" />
</j:when>
<j:when test="${build.result=='FAILURE'}">
<img src="${rooturl}static/e59dfe28/images/32x32/red.gif" />
</j:when>
<j:otherwise>
<img src="${rooturl}static/e59dfe28/images/32x32/yellow.gif" />
</j:otherwise>
</j:choose>
</td>
<td valign="center">
<b style="font-size: 200%;">BUILD ${build.result}</b>
</td>
</tr>
<tr>
<td>Build Log</td>
<td>
<a href="${rooturl}${build.url}/console">Log</a>
</td>
</tr>
<tr>
<td>Build URL</td>
<td>
<a href="${rooturl}${build.url}">${rooturl}${build.url}</a>
</td>
</tr>
<tr>
<td>Project:</td>
<td>${project.name}</td>
</tr>
<tr>
<td>Project URL:</td>
<j:set var="projectUrl" value="${rooturl}${build.url}" />
<td>
<a href="${projectUrl.substring(0, projectUrl.length() - build.number.toString().length() - 2)}">${projectUrl.substring(0, projectUrl.length() - (build.number.toString().length() + 2))}</a>
</td>
</tr>
<tr>
<td>Date of build:</td>
<td>${it.timestampString}</td>
</tr>
<tr>
<td>Build duration:</td>
<td>${build.durationString}</td>
</tr>
<tr>
<td>Build cause:</td>
<td>
<j:forEach var="cause" items="${build.causes}">${cause.shortDescription} </j:forEach>
</td>
</tr>
<tr>
<td>Build description:</td>
<td>${build.description}</td>
</tr>
<tr>
<td>Built on:</td>
<td>
<j:choose>
<j:when test="${build.builtOnStr!=''}">${build.builtOnStr}</j:when>
<j:otherwise>master</j:otherwise>
</j:choose>
</td>
</tr>
</table>
</div>
<!-- HEALTH TEMPLATE -->
<div class="content">
<j:set var="healthIconSize" value="16x16" />
<j:set var="healthReports" value="${project.buildHealthReports}" />
<j:if test="${healthReports!=null}">
<h1>Health Report</h1>
<table>
<tr>
<th>W</th>
<th>Description</th>
<th>Score</th>
</tr>
<j:forEach var="healthReport" items="${healthReports}">
<tr>
<td>
<img src="${rooturl}${healthReport.getIconUrl(healthIconSize)}" />
</td>
<td>${healthReport.description}</td>
<td>${healthReport.score}</td>
</tr>
</j:forEach>
</table>
<br />
</j:if>
</div>
<!-- CHANGE SET -->
<!--div class="content">
<j:set var="changeSet" value="${build.changeSet}" />
<j:if test="${changeSet!=null}">
<j:set var="hadChanges" value="false" />
<a href="${rooturl}${build.url}/changes">
<h1>Changes</h1>
</a>
<j:forEach var="cs" items="${changeSet.logs}" varStatus="loop">
<j:set var="hadChanges" value="true" />
<h2>${cs.msgAnnotated}</h2>
<p>by <em>${cs.author}</em></p>
<table>
<j:forEach var="p" items="${cs.affectedFiles}">
<tr>
<td width="10%">${spc}${p.editType.name}</td>
<td>
<tt>${p.path}</tt>
</td>
</tr>
</j:forEach>
</table>
</j:forEach>
<j:if test="${!hadChanges}">
<p>No Changes</p>
</j:if>
<br />
</j:if>
</div-->
<!-- ARTIFACTS -->
<j:set var="artifacts" value="${build.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<div class="content">
<h1>Build Artifacts</h1>
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
<a href="${rooturl}${build.url}artifact/${f}">${f}</a>
</li>
</j:forEach>
</ul>
</div>
</j:if>
<!-- MAVEN ARTIFACTS -->
<j:set var="mbuilds" value="${build.moduleBuilds}" />
<j:if test="${mbuilds!=null}">
<div class="content">
<h1>Build Artifacts</h1>
<j:forEach var="m" items="${mbuilds}">
<h2>${m.key.displayName}</h2>
<j:forEach var="mvnbld" items="${m.value}">
<j:set var="artifacts" value="${mvnbld.artifacts}" />
<j:if test="${artifacts!=null and artifacts.size()>0}">
<ul>
<j:forEach var="f" items="${artifacts}">
<li>
<a href="${rooturl}${mvnbld.url}artifact/${f}">${f}</a>
</li>
</j:forEach>
</ul>
</j:if>
</j:forEach>
</j:forEach>
<br />
</div>
</j:if>
<!-- JUnit TEMPLATE -->
<j:set var="junitResultList" value="${it.JUnitTestResult}" />
<j:if test="${junitResultList.isEmpty()!=true}">
<div class="content">
<a href="${rooturl}${build.url}/testReport">
<h1>JUnit Tests</h1>
</a>
<table class="border">
<tr>
<th class="border">Package</th>
<th class="border">Failed</th>
<th class="border">Passed</th>
<th class="border">Skipped</th>
<th class="border">Total</th>
</tr>
<j:forEach var="junitResult" items="${it.JUnitTestResult}">
<j:forEach var="packageResult" items="${junitResult.getChildren()}">
<tr>
<td class="border">
<tt>${packageResult.getName()}</tt>
</td>
<td class="border test_failed">${packageResult.getFailCount()}</td>
<td class="border test_passed">${packageResult.getPassCount()}</td>
<td class="border test_skipped">${packageResult.getSkipCount()}</td>
<td class="border">
<b>${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}</b>
</td>
</tr>
<j:forEach var="failed_test" items="${packageResult.getFailedTests()}">
<tr>
<td class="test_failed" colspan="5">
<tt>${failed_test.getFullName()}</tt>
</td>
</tr>
</j:forEach>
</j:forEach>
</j:forEach>
</table>
<br />
</div>
</j:if>
<!-- COBERTURA TEMPLATE -->
<j:set var="coberturaAction" value="${it.coberturaAction}" />
<j:if test="${coberturaAction!=null}">
<div class="content">
<j:set var="coberturaResult" value="${coberturaAction.result}" />
<j:if test="${coberturaResult!=null}">
<a href="${rooturl}${build.url}/cobertura">
<h1>Cobertura Report</h1>
</a>
<h2>Project Coverage Summary</h2>
<table class="border">
<tr>
<th class="border">Name</th>
<j:forEach var="metric" items="${coberturaResult.metrics}">
<th class="border">${metric.name}</th>
</j:forEach>
</tr>
<tr>
<td class="border">${coberturaResult.name}</td>
<j:forEach var="metric" items="${coberturaResult.metrics}">
<td class="border" data="${coberturaResult.getCoverage(metric).percentageFloat}">${coberturaResult.getCoverage(metric).percentage}%
(${coberturaResult.getCoverage(metric)})
</td>
</j:forEach>
</tr>
</table>
<j:if test="${coberturaResult.sourceCodeLevel}">
<h2>Source</h2>
<j:choose>
<j:when test="${coberturaResult.sourceFileAvailable}">
<div style="overflow-x:scroll;">
<table class="source">
<thead>
<tr>
<th colspan="3">${coberturaResult.relativeSourcePath}</th>
</tr>
</thead>
${coberturaResult.sourceFileContent}
</table>
</div>
</j:when>
<j:otherwise>
<p>
<i>Source code is unavailable</i>
</p>
</j:otherwise>
</j:choose>
</j:if>
<j:forEach var="element" items="${coberturaResult.childElements}">
<j:set var="childMetrics" value="${coberturaResult.getChildMetrics(element)}" />
<h2>Coverage Breakdown by ${element.displayName}</h2>
<table class="border">
<tr>
<th class="border">Name</th>
<j:forEach var="metric" items="${childMetrics}">
<th class="border">${metric.name}</th>
</j:forEach>
</tr>
<j:forEach var="c" items="${coberturaResult.children}">
<j:set var="child" value="${coberturaResult.getChild(c)}" />
<tr>
<td class="border">
${child.xmlTransform(child.name)}
</td>
<j:forEach var="metric" items="${childMetrics}">
<j:set var="childResult" value="${child.getCoverage(metric)}" />
<j:choose>
<j:when test="${childResult!=null}">
<td class="border" data="${childResult.percentageFloat}">${childResult.percentage}%
(${childResult})
</td>
</j:when>
<j:otherwise>
<td class="border" data="101">N/A</td>
</j:otherwise>
</j:choose>
</j:forEach>
</tr>
</j:forEach>
</table>
</j:forEach>
</j:if>
<br />
</div>
</j:if>
<!-- WORKSPACE -->
<div class="content">
<j:if test="${build.workspace.list().size()>0}">
<j:set var="buildLogExist" value="False" />
<j:set var="workspaceUrl" value="${rooturl}${build.url}" />
<!--a href="${workspaceUrl.substring(0, workspaceUrl.length() - (build.number.toString().length + 2))}/ws">
<h1>Workspace</h1>
</a-->
<!--h1>"${build.workspace}"</h1-->
<j:forEach var="file" items="${build.workspace.list()}" varStatus="loop">
<j:if test="${line.indexOf('build_log') != -1}">
<j:set var="buildLogExist" value="True" />
</j:if>
<!--table>
<tr>
<td>
<tt>${file.toString().replace(build.workspace.toString()+'/', '')}</tt>
</td>
</tr>
</table-->
</j:forEach>
<br />
</j:if>
</div>
<j:forEach var="line" items="${build.getLog(999999)}">
<j:if test="${line.indexOf('Some dependencies are not available:') != -1}">
<j:set var="buildLogExist" value="False" />
<a href="${rooturl}${build.url}/console">
<h1>UNAVAILABLE DEPENDECIES</h1>
</a>
<tr>
<td><tt>
<b>${line}</b><br/>
Add dependency repository in pipeline configuration!
</tt></td>
</tr>
</j:if>
</j:forEach>
<j:if test="${buildLogExist=='True'}">
<j:choose>
<j:when test="${build.result=='FAILURE'}">
<div class="content">
<!-- BUILD FAILURE -->
<a href="${rooturl}${build.url}/console">
<h1>Failed Builds</h1>
</a>
<table class="console">
<j:forEach var="line" items="${build.getLog(100000)}">
<j:if test="${line.indexOf('[Build Fail]') != -1}">
<j:set var="buildLogUrl" value="${rooturl}${build.url}" />
<tr>
<td><tt>
<a href="${buildLogUrl.replace('/' + build.number.toString() + '/', '')}/ws/build_logs/${line.substring(line.indexOf(' --- ') + 5, line.length())}/build_output.log">
${line}
</a>
</tt></td>
</tr>
</j:if>
</j:forEach>
</table>
<br />
</div>
</j:when>
<j:when test="${build.result=='UNSTABLE'}">
<div class="content">
<!-- TEST FAILURE -->
<a href="${rooturl}${build.url}/console">
<h1>Unstable Tests</h1>
</a>
<table class="console">
<j:forEach var="line" items="${build.getLog(100000)}">
<j:if test="${line.indexOf('[Not Built ]') != -1}">
<j:if test="${line.indexOf('[Test Fail]') != -1}">
<j:set var="testLogUrl" value="${rooturl}${build.url}" />
<tr>
<td><tt>
<a href="${testLogUrl.replace('/' + build.number.toString() + '/', '')}/ws/build_logs/${line.substring(line.indexOf(' --- ') + 5, line.length())}/build_test_output.log">
${line}
</a>
</tt></td>
</tr>
</j:if>
</j:if>
</j:forEach>
</table>
<br />
</div>
</j:when>
</j:choose>
<div class="content">
<!-- BUILDS -->
<a href="${rooturl}${build.url}/console">
<h1>All Builds</h1>
</a>
<table class="console">
<j:forEach var="line" items="${build.getLog(100000)}">
<j:choose>
<j:when test="${line.indexOf('[ Built ]') != -1}">
<tr>
<td><tt>${line}</tt></td>
</tr>
</j:when>
<!--j:when test="${line.indexOf('[Not Built ]') != -1}">
<tr>
<td><tt>${line}</tt></td>
</tr>
</j:when-->
<j:when test="${line.indexOf('[Build Fail]') != -1}">
<j:set var="buildLogUrl" value="${rooturl}${build.url}" />
<tr>
<td><tt>
<a href="${buildLogUrl.replace('/' + build.number.toString() + '/', '')}/ws/build_logs/${line.substring(line.indexOf(' --- ') + 5, line.length())}/build_output.log">
${line}
</a>
</tt></td>
</tr>
</j:when>
</j:choose>
</j:forEach>
</table>
<br />
</div>
<j:if test="${build.result=='UNSTABLE'}">
<div class="content">
<!-- TESTS -->
<a href="${rooturl}${build.url}/console">
<h1>All Tests</h1>
</a>
<table class="console">
<j:forEach var="line" items="${build.getLog(100000)}">
<j:if test="${line.indexOf('[Not Built ]') != -1}">
<j:choose>
<j:when test="${line.indexOf('[Test Pass]') != -1}">
<j:set var="testLogUrl" value="${rooturl}${build.url}" />
<tr>
<td><tt>
<a href="${testLogUrl.replace('/' + build.number.toString() + '/', '')}/ws/build_logs/${line.substring(line.indexOf(' --- ') + 5, line.length())}/build_test_output.log">
${line}
</a>
</tt></td>
</tr>
</j:when>
<j:when test="${line.indexOf('[Test Fail]') != -1}">
<j:set var="testLogUrl" value="${rooturl}${build.url}" />
<tr>
<td><tt>
<a href="${testLogUrl.replace('/' + build.number.toString() + '/', '')}/ws/build_logs/${line.substring(line.indexOf(' --- ') + 5, line.length())}/build_test_output.log">
${line}
</a>
</tt></td>
</tr>
</j:when>
<j:when test="${line.indexOf('[Untested ]') != -1}">
<tr>
<td><tt>${line}</tt></td>
</tr>
</j:when>
</j:choose>
</j:if>
</j:forEach>
</table>
<br />
</div>
</j:if>
</j:if>
<!-- CONSOLE OUTPUT -->
<!--div class="content">
<a href="${rooturl}${build.url}/console">
<h1>Console Output</h1>
</a>
<table class="console">
<j:forEach var="line" items="${build.getLog(50)}">
<tr>
<td><tt>${line}</tt></td>
</tr>
</j:forEach>
</table>
<br />
</div-->
</body>
</html>
</j:jelly>