Newer
Older
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
#!/bin/bash
function usage {
echo "OAI Local Build Report script"
echo " Original Author: Raphael Defosseux"
echo ""
echo "Usage:"
echo "------"
echo ""
echo " reportBuildLocally.sh [OPTIONS]"
echo ""
echo "Options:"
echo "--------"
echo ""
echo " --help OR -h"
echo " Print this help message."
echo ""
echo "Job Options:"
echo "------------"
echo ""
echo " --git-url #### OR -gu ####"
echo " Specify the URL of the GIT Repository."
echo ""
echo " --job-name #### OR -jn ####"
echo " Specify the name of the Jenkins job."
echo ""
echo " --build-id #### OR -id ####"
echo " Specify the build ID of the Jenkins job."
echo ""
echo " --trigger merge-request OR -mr"
echo " --trigger push OR -pu"
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
echo ""
echo "Merge-Request Options:"
echo "----------------------"
echo ""
echo " --src-branch #### OR -sb ####"
echo " Specify the source branch of the merge request."
echo ""
echo " --src-commit #### OR -sc ####"
echo " Specify the source commit ID (SHA-1) of the merge request."
echo ""
echo " --target-branch #### OR -tb ####"
echo " Specify the target branch of the merge request (usually develop)."
echo ""
echo " --target-commit #### OR -tc ####"
echo " Specify the target commit ID (SHA-1) of the merge request."
echo ""
echo "Push Options:"
echo "----------------------"
echo ""
echo " --branch #### OR -br ####"
echo " Specify the branch of the push event."
echo ""
echo " --commit #### OR -co ####"
echo " Specify the commit ID (SHA-1) of the push event."
echo ""
echo ""
}
function trigger_usage {
echo "OAI Local Build Report script"
echo " Original Author: Raphael Defosseux"
echo ""
echo " --trigger merge-request OR -mr"
echo " --trigger push OR -pu"
echo " Specify trigger action of the Jenkins job. Either a merge-request event or a push event."
echo ""
}
jb_checker=0
mr_checker=0
pu_checker=0
MR_TRIG=0
PU_TRIG=0
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|--help)
shift
usage
exit 0
;;
-gu|--git-url)
GIT_URL="$2"
let "jb_checker|=0x1"
shift
shift
;;
-jn|--job-name)
JOB_NAME="$2"
let "jb_checker|=0x2"
shift
shift
;;
-id|--build-id)
BUILD_ID="$2"
let "jb_checker|=0x4"
shift
shift
;;
--trigger)
TRIG="$2"
case $TRIG in
merge-request)
MR_TRIG=1
;;
push)
PU_TRIG=1
;;
*)
echo ""
echo "Syntax Error: Invalid Trigger option -> $TRIG"
echo ""
trigger_usage
exit
;;
esac
let "jb_checker|=0x8"
shift
shift
;;
-mr)
MR_TRIG=1
let "jb_checker|=0x8"
shift
;;
-pu)
PU_TRIG=1
let "jb_checker|=0x8"
shift
;;
-sb|--src-branch)
SOURCE_BRANCH="$2"
let "mr_checker|=0x1"
shift
shift
;;
-sc|--src-commit)
SOURCE_COMMIT_ID="$2"
let "mr_checker|=0x2"
shift
shift
;;
-tb|--target-branch)
TARGET_BRANCH="$2"
let "mr_checker|=0x4"
shift
shift
;;
-tc|--target-commit)
TARGET_COMMIT_ID="$2"
let "mr_checker|=0x8"
shift
shift
;;
-br|--branch)
SOURCE_BRANCH="$2"
let "pu_checker|=0x1"
shift
shift
;;
-co|--commit)
SOURCE_COMMIT_ID="$2"
let "pu_checker|=0x2"
shift
shift
;;
*)
echo "Syntax Error: unknown option: $key"
echo ""
usage
exit 1
;;
esac
done
if [ $jb_checker -ne 15 ]
then
echo ""
echo "Syntax Error: missing job information."
# TODO : list missing info
echo ""
exit 1
fi
if [ $PU_TRIG -eq 1 ] && [ $MR_TRIG -eq 1 ]
then
echo ""
echo "Syntax Error: trigger action incoherent."
echo ""
trigger_usage
exit 1
fi
if [ $PU_TRIG -eq 1 ]
then
if [ $pu_checker -ne 3 ]
then
echo ""
echo "Syntax Error: missing push information."
# TODO : list missing info
echo ""
exit 1
fi
fi
if [ $MR_TRIG -eq 1 ]
then
if [ $mr_checker -ne 15 ]
then
echo ""
echo "Syntax Error: missing merge-request information."
# TODO : list missing info
echo ""
exit 1
fi
fi
echo "<!DOCTYPE html>" > ./build_results.html
echo "<html class=\"no-js\" lang=\"en-US\">" >> ./build_results.html
echo "<head>" >> ./build_results.html
echo " <title>Build Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./build_results.html
echo "</head>" >> ./build_results.html
echo "<body>" >> ./build_results.html
echo " <h1>Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</h1>" >> ./build_results.html
echo " <table border = \"1\">" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >GIT Repository</td>" >> ./build_results.html
echo " <td>$GIT_URL</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Job Trigger</td>" >> ./build_results.html
if [ $PU_TRIG -eq 1 ]; then echo " <td>Push Event</td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td>Merge-Request</td>" >> ./build_results.html; fi
echo " </tr>" >> ./build_results.html
if [ $PU_TRIG -eq 1 ]
then
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Branch</td>" >> ./build_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
fi
if [ $MR_TRIG -eq 1 ]
then
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Source Branch</td>" >> ./build_results.html
echo " <td>$SOURCE_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Source Commit ID</td>" >> ./build_results.html
echo " <td>$SOURCE_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Target Branch</td>" >> ./build_results.html
echo " <td>$TARGET_BRANCH</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Target Commit ID</td>" >> ./build_results.html
echo " <td>$TARGET_COMMIT_ID</td>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
fi
echo " </table>" >> ./build_results.html
echo " <h2>Build Summary</h2>" >> ./build_results.html
if [ -f ./oai_rules_result.txt ]
then
echo " <h3>OAI Coding / Formatting Guidelines Check</h3>" >> ./build_results.html
echo " <table border = "1">" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Result:</td>" >> ./build_results.html
NB_FILES=`cat ./oai_rules_result.txt`
if [ $NB_FILES = "0" ]
then
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi
else
if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi
if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi
fi
echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html
fi
echo " <h3>OAI Build eNb -- USRP option</h3>" >> ./build_results.html
echo " <table border = "1">" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <th>Element</th>" >> ./build_results.html
echo " <th>Status</th>" >> ./build_results.html
echo " <th>Nb Errors</th>" >> ./build_results.html
echo " <th>Nb Warnings</th>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >LTE SoftModem - Release 14</th>" >> ./build_results.html
if [ -f ./archives/enb_usrp/lte-softmodem.Rel14.txt ]
then
STATUS=`egrep -c "Built target lte-softmodem" ./archives/enb_usrp/lte-softmodem.Rel14.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/enb_usrp/lte-softmodem.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/enb_usrp/lte-softmodem.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Coding - Release 14</th>" >> ./build_results.html
if [ -f ./archives/enb_usrp/coding.Rel14.txt ]
then
STATUS=`egrep -c "Built target coding" ./archives/enb_usrp/coding.Rel14.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/enb_usrp/coding.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/enb_usrp/coding.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >OAI USRP device if - Release 14</th>" >> ./build_results.html
if [ -f ./archives/enb_usrp/oai_usrpdevif.Rel14.txt ]
then
STATUS=`egrep -c "Built target oai_usrpdevif" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/enb_usrp/oai_usrpdevif.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Parameters Lib Config - Release 14</th>" >> ./build_results.html
if [ -f ./archives/enb_usrp/params_libconfig.Rel14.txt ]
then
STATUS=`egrep -c "Built target params_libconfig" ./archives/enb_usrp/params_libconfig.Rel14.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/enb_usrp/params_libconfig.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/enb_usrp/params_libconfig.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html
# conf2uedata.Rel14.txt
# archives/basic_sim
echo " <h3>OAI Build basic simulator option</h3>" >> ./build_results.html
echo " <table border = "1">" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <th>Element</th>" >> ./build_results.html
echo " <th>Status</th>" >> ./build_results.html
echo " <th>Nb Errors</th>" >> ./build_results.html
echo " <th>Nb Warnings</th>" >> ./build_results.html
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Basic Simulator eNb - Release 14</th>" >> ./build_results.html
if [ -f ./archives/basic_sim/basic_simulator_enb.txt ]
then
STATUS=`egrep -c "Built target lte-softmodem" ./archives/basic_sim/basic_simulator_enb.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/basic_sim/basic_simulator_enb.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/basic_sim/basic_simulator_enb.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Basic Simulator UE - Release 14</th>" >> ./build_results.html
if [ -f ./archives/basic_sim/basic_simulator_ue.txt ]
then
STATUS=`egrep -c "Built target lte-uesoftmodem" ./archives/basic_sim/basic_simulator_ue.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/basic_sim/basic_simulator_ue.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/basic_sim/basic_simulator_ue.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " <tr>" >> ./build_results.html
echo " <td bgcolor = \"lightcyan\" >Conf 2 UE data - Release 14</th>" >> ./build_results.html
if [ -f ./archives/basic_sim/conf2uedata.Rel14.txt ]
then
STATUS=`egrep -c "Built target conf2uedata" ./archives/basic_sim/conf2uedata.Rel14.txt`
if [ $STATUS -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >KO</th>" >> ./build_results.html
fi
STATUS=`egrep -c "error:" ./archives/basic_sim/conf2uedata.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"red\" >$STATUS</th>" >> ./build_results.html
fi
STATUS=`egrep -c "warning:" ./archives/basic_sim/conf2uedata.Rel14.txt`
if [ $STATUS -eq 0 ]
then
echo " <td bgcolor = \"green\" >$STATUS</th>" >> ./build_results.html
else
echo " <td bgcolor = \"orange\" >$STATUS</th>" >> ./build_results.html
fi
else
echo " <td bgcolor = \"lightgray\" >Unknown</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
echo " <td bgcolor = \"lightgray\" >--</th>" >> ./build_results.html
fi
echo " </tr>" >> ./build_results.html
echo " </table>" >> ./build_results.html
echo "</body>" >> ./build_results.html
echo "</html>" >> ./build_results.html
exit 0