-
-
Notifications
You must be signed in to change notification settings - Fork 287
/
common.tt
384 lines (338 loc) · 13.9 KB
/
common.tt
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
[%- USE date -%]
[%- USE String -%]
[%- USE HTML -%]
[%- inputTypes =
{ "svn" = "Subversion export"
, "svn-checkout" = "Subversion checkout"
, "bzr" = "Bazaar export"
, "bzr-checkout" = "Bazaar checkout"
, "git" = "Git checkout"
, "tarball" = "Download of a tarball"
, "hg" = "Mercurial checkout"
, "string" = "String value"
, "boolean" = "Boolean"
, "path" = "Local path"
, "build" = "Build output"
, "sysbuild" = "Build output (same system)"
}
-%]
[%- BLOCK renderDateTime -%]
[% date.format(timestamp, '%Y-%m-%d %H:%M:%S') -%]
[%- END -%]
[%- BLOCK renderProjectName -%]
<a href="[% c.uri_for('/project' project) %]"><tt>[% project %]</tt></a>[% END -%]
[%- BLOCK renderJobsetName -%]
<a href="[% c.uri_for('/jobset' project jobset) %]"><tt>[% jobset %]</tt></a>[% END -%]
[%- BLOCK renderJobName -%]
<a href="[% c.uri_for('/job' project jobset job) %]"><tt>[% job %]</tt></a>[% END -%]
[%- BLOCK renderFullJobsetName -%]
<tt>
[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]
</tt>
[% END %]
[%- BLOCK renderFullJobName -%]
<tt>[% IF !hideProjectName; INCLUDE renderProjectName %]:[% END; IF !hideJobsetName; INCLUDE renderJobsetName %]:[% END; INCLUDE renderJobName %]</tt>
[%- END %]
[%- BLOCK renderFullJobNameOfBuild -%]
[% INCLUDE renderFullJobName project=build.get_column("project") jobset = build.get_column("jobset") job = build.get_column("job") %]
[% END %]
[%- BLOCK renderDuration -%]
[% IF duration >= 24 * 60 * 60 %][% duration div (24 * 60 * 60) %]d[% END %]
[% IF duration >= 60 * 60 %][% duration div (60 * 60) % 24 %]h[% END %]
[% IF duration >= 60 %][% duration div 60 % 60 %]m[% END %]
[% duration % 60 %]s
[% END %]
[%- BLOCK renderBuildList -%]
<table class="buildList tablesorter[% IF !showSchedulingInfo %] clean[% END %]">
<thead>
<tr>
[%- IF !hideResultInfo -%]
<th></th>
[% END %]
<th>#</th>
[%- IF showSchedulingInfo -%]
<th></th>
<th>P</th>
[%- END -%]
[%- IF !hideJobName -%]
<th>Job</th>
[%- END -%]
<th>Release Name</th>
<th>System</th>
<th>Timestamp</th>
[%- IF showStatusChange -%]
<th class="headerSortUp">Last status change</th>
[%- END -%]
[%- IF showDescription -%]
<th>Description</th>
[%- END -%]
</tr>
</thead>
<tbody>
[%- odd = 0 -%]
[%- FOREACH build IN builds -%]
<tr class="clickable
[%- IF showSchedulingInfo -%]
[%- IF build.busy %]runningBuild[% ELSIF build.disabled == 1 || build.get_column('enabled') == 0 %]disabledBuild[% END -%]
[%- ELSE -%]
[%- IF odd %] odd [% END; odd = !odd -%]
[%- END %]"
onclick="if(event.which == 2) return true; window.location = '[% c.uri_for('/build' build.id) %]'">
[%- IF !hideResultInfo -%]
<td>
[%- INCLUDE renderBuildStatusIcon size=16 busy=(showSchedulingInfo ? 1 : 0) buildstatus=build.buildstatus -%]
</td>
[%- END -%]
<td><a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a></td>
[%- IF showSchedulingInfo -%]
<td>[% IF build.busy %]<img src="/static/images/running.gif" alt="Running" />[% ELSIF build.disabled == 1 || build.get_column('enabled') == 0 %]Disabled[% END %]</td>
<td>[% build.priority %]</td>
[%- END -%]
[%- IF !hideJobName -%]
<td>[%- INCLUDE renderFullJobNameOfBuild -%]</td>
[%- END -%]
<td>[% !showSchedulingInfo and build.get_column('releasename') ? build.get_column('releasename') : build.nixname %]</td>
<td><tt>[% build.system %]</tt></td>
<td>[% date.format(build.timestamp, '%Y-%m-%d %H:%M:%S') %]</td>
[%- IF showStatusChange -%]
<td>
[%- IF build.get_column('statusChangeTime') -%]
<a href="[% c.uri_for('/build' build.get_column('statusChangeId')) %]">
[% date.format(build.get_column('statusChangeTime'), '%Y-%m-%d %H:%M:%S') %]
</a>
[%- ELSE -%]
<em>never</em>
[%- END -%]
</td>
[%- END -%]
[%- IF showDescription -%]
<td>[% build.description %]</td>
[%- END -%]
</tr>
[%- END -%]
</tbody>
</table>
[%- END -%]
[%- BLOCK renderLink -%]<a href="[% uri %]">[% title %]</a>[%- END -%]
[%- BLOCK showBuildStats -%]
<table class="layoutTable">
<tr>
<th>Finished builds:</th>
<td>[% finishedBuilds %]</td>
</tr>
<tr>
<th><img src="/static/images/checkmark_16.png" alt="Succeeded" /> Succeeded builds:</th>
<td>[% succeededBuilds %]</td>
</tr>
<tr>
<th><img src="/static/images/error_16.png" alt="Failed" /> Failed builds:</th>
<td>[% finishedBuilds - succeededBuilds %]</td>
</tr>
<tr>
<th>Total build time:</th>
<td>[% INCLUDE renderDuration duration = totalBuildTime %]</td>
</tr>
<tr>
<th>Scheduled builds:</th>
<td>[% scheduledBuilds %]</td>
</tr>
<tr>
<th>Currently executing builds:</th>
<td>[% busyBuilds %]</td>
</tr>
</table>
[%- END -%]
[% BLOCK renderViewJobName -%]
[% IF job.description; HTML.escape(job.description); ELSE %]<tt>[% job.job %]</tt> ([% job.attrs %])[% END -%]
[% END -%]
[% BLOCK maybeLink -%]
[% IF uri %]<a [% HTML.attributes(href => uri) %][% IF confirmmsg %]onclick="javascript:return confirm('[% confirmmsg %]')"[% END %]>[% content %]</a>[% ELSE; content; END -%]
[% END -%]
[% BLOCK renderSelection %]
[% IF edit %]
<select [% HTML.attributes(id => param, name => param) %]>
[% FOREACH name IN options.keys.sort %]
<option [% HTML.attributes(value => name) %] [% IF name == curValue; "selected='selected'"; END %]>[% options.$name %]</option>
[% END %]
</select>
[% ELSE %]
[% options.$curValue %]
[% END %]
[% END %]
[% BLOCK maybeEditString;
IF edit -%]
<input type="text" class="string [% extraClass %]" [% HTML.attributes(id => param, name => param, value => value) %] />
[% ELSE;
HTML.escape(value);
END -%]
[% END -%]
[% BLOCK renderFullBuildLink %]
[% INCLUDE renderFullJobNameOfBuild build=build %] <a href="[% c.uri_for('/build' build.id) %]">build [% build.id %]</a>[% -%]
[% END %]
[%- BLOCK renderBuildStatusIcon -%]
[%- finished = build != undef ? build.finished : 1 -%]
[%- busy = busy != undef ? busy : build.busy -%]
[%- buildstatus = buildstatus != undef ? buildstatus : build.buildstatus -%]
[%- IF finished -%]
[%- IF buildstatus == 0 -%]
<img src="/static/images/checkmark_[% size %].png" alt="Succeeded" />
[%- ELSIF buildstatus == 1 -%]
<img src="/static/images/error_[% size %].png" alt="Failed" />
[%- ELSIF buildstatus == 2 -%]
<img src="/static/images/dependency_[% size %].png" alt="Dependency failed" />
[%- ELSIF buildstatus == 4 -%]
<img src="/static/images/error_[% size %].png" alt="Failed" />
[%- ELSIF buildstatus == 5 -%]
<img src="/static/images/error_[% size %].png" alt="Failed" />
[%- ELSIF buildstatus == 6 -%]
<img src="/static/images/error_[% size %].png" alt="Failed (with result)" />
[%- ELSE -%]
<img src="/static/images/error_[% size %].png" alt="Failed" />
[%- END -%]
[%- ELSIF busy -%]
<img src="/static/images/help_[% size %].png" alt="Busy" />
[%- ELSE -%]
<img src="/static/images/help_[% size %].png" alt="Scheduled" />
[%- END -%]
[%- END -%]
[% BLOCK renderStatus %]
[% IF build.finished %]
[% buildstatus = build.buildstatus %]
[% INCLUDE renderBuildStatusIcon size=16 %]
[% IF buildstatus == 0 %]
<strong>Success</strong>
[% ELSIF buildstatus == 1 %]
<span class="error">Build returned a non-zero exit code</span>
[% ELSIF buildstatus == 2 %]
<span class="error">A dependency of the build failed</span>
[% ELSIF buildstatus == 4 %]
<span class="error">Cancelled by user</span>
[% ELSIF buildstatus == 5 %]
<span class="error">Build inhibited because a dependency previously failed to build</span>
[% ELSIF buildstatus == 6 %]
<span class="error">Build failed (with result)</span>
[% ELSE %]
<span class="error">Build failed</span>
(see <a href="#nix-error">below</a>)
[% END %]
[% IF c.user_exists && (buildstatus == 3 || buildstatus == 4) %]
<form action="[% c.uri_for('/build' build.id 'restart') %]" method="post" class="inline">
<button id="restart" type="submit">Restart</button>
</form>
[% END %]
[% ELSIF build.busy %]
<strong>Build in progress</strong>
since [% INCLUDE renderDateTime timestamp = build.starttime %]
[% ELSE %]
<strong>Scheduled to be built</strong>
[% IF c.user_exists %]
<form action="[% c.uri_for('/build' build.id 'cancel') %]" method="post" class="inline">
<button id="cancel" type="submit">Cancel</button>
</form>
[% END %]
[% END %]
[% END -%]
[% BLOCK renderInputValue %]
[% IF input.type == "build" || input.type == "sysbuild" %]
[% INCLUDE renderFullBuildLink build=input.dependency %]</a>
[% ELSIF input.type == "string" || input.type == "boolean" %]
<tt>"[% input.value %]"</tt>
[% ELSE %]
<tt>[% input.uri %][% IF input.revision %] (r. [% input.revision %])[% END %]</tt>
[% END %]
[% END %]
[% BLOCK renderShortInputValue %]
[% IF input.type == "build" || input.type == "sysbuild" %]
<a href="[% c.uri_for('/build' input.dependency.id) %]">[% input.dependency.id %]</a>
[% ELSIF input.type == "string" || input.type == "boolean" %]
<tt>"[% input.value %]"</tt>
[% ELSE %]
<tt>[% input.uri %][% IF input.revision %] (r. [% input.revision %])[% END %]</tt>
[% END %]
[% END %]
[% BLOCK renderDiffUri; %]
[% nouri = 1 %]
[% FOREACH m IN mappers %]
[% base = m.baseuri %]
[% url = bi1.uri %]
[% path = url.replace(base, '') %]
[% IF url.match(base) %]
<a target="_new" href="[% m.uri.replace('_path_', path).replace('_1_', bi1.revision).replace('_2_', bi2.revision) %]">[% contents %]</a>
[% nouri = 0 %]
[% END %]
[% END %]
[% IF nouri %]
[% res = bi1.uri.split(' ') %]
[% url = res.0 %]
[% branch = res.1 %]
[% IF bi1.type == "hg" || bi1.type == "git" %]
<a target="_new" href="/api/scmdiff?uri=[% url %]&rev1=[% bi1.revision %]&rev2=[% bi2.revision %]&type=[% bi1.type %]&branch=[% branch %]">[% contents %]</a>
[% ELSE %]
[% contents %]
[% END %]
[% END %]
[% END %]
[% BLOCK renderInputDiff; %]
<table class="tablesorter clean">
[% IF !nestedDiff %]
<tr><th>Input</th><th>Changes</th></tr>
[% END %]
[% FOREACH bi1 IN build1.inputs %]
[% deletedInput = 1 %]
[% FOREACH bi2 IN build2.inputs %]
[% IF bi1.name == bi2.name %]
[% IF bi1.type == bi2.type %]
[% IF bi1.value != bi2.value || bi1.uri != bi2.uri %]
<tr><td><b>[% bi1.name %]</b></td><td><tt>[% INCLUDE renderShortInputValue input=bi1 %] to [% INCLUDE renderShortInputValue input=bi2 %]</tt></td></tr>
[% ELSIF bi1.uri == bi2.uri && bi1.revision != bi2.revision %]
[% IF bi1.type == "git" %]
<tr><td>
<b>[% bi1.name %]</b></td><td><tt>[% INCLUDE renderDiffUri contents=(bi1.revision.substr(0, 6) _ ' to ' _ bi2.revision.substr(0, 6)) %]</tt>
</td></tr>
[% ELSE %]
<tr><td>
<b>[% bi1.name %]</b></td><td><tt>[% INCLUDE renderDiffUri contents=(bi1.revision _ ' to ' _ bi2.revision) %]</tt>
</td></tr>
[% END %]
[% ELSIF bi1.dependency.id != bi2.dependency.id || bi1.path != bi2.path %]
<tr><td>
<b>[% bi1.name %]</b></td><td><tt>[% INCLUDE renderShortInputValue input=bi1 %] to [% INCLUDE renderShortInputValue input=bi2 %]</tt>
<br/>
<br/>
[% INCLUDE renderInputDiff build1=bi1.dependency, build2=bi2.dependency, nestedDiff=1 %]
</td></tr>
[% END %]
[% ELSE %]
<tr><td><b>[% bi1.name %]</b></td><td>Changed input type from '[% type = bi1.type; inputTypes.$type %]' to '[% type = bi2.type; inputTypes.$type %]'</td></tr>
[% END %]
[% deletedInput = 0 %]
[% END %]
[% END %]
[% IF deletedInput == 1 %]
<tr><td><b>[% bi1.name %]</b></td><td>Input not present in this build.</td></tr>
[% END %]
[% END %]
</table>
[% END %]
[% BLOCK hydraStatus %]
<table class="tablesorter">
<thead>
<tr><th>Machine</th><th>Job</th><th>Type</th><th>Build</th><th>Step</th><th>What</th><th>Since</th></tr>
</thead>
<tbody>
[% FOREACH step IN steps %]
<tr>
<td><tt>[% IF step.machine; step.machine.match('@(.*)').0; ELSE; 'localhost'; END %]</tt></td>
<td><tt>[% INCLUDE renderFullJobName project = step.build.project.name jobset = step.build.jobset.name job = step.build.job.name %]</tt></td>
<td><tt>[% step.system %]</tt></td>
<td><a href="[% c.uri_for('/build' step.build.id) %]">[% step.build.id %]</a></td>
<td><a href="[% c.uri_for('/build' step.build.id 'nixlog' step.stepnr 'tail-reload') %]">[% step.stepnr %]</a></td>
<td><tt>[% step.outpath.match('-(.*)').0 %]</tt></td>
<td class='right'>[% INCLUDE renderDuration duration = curTime - step.starttime %] </td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% BLOCK buildsGraph %]
[% END %]