9
9
10
10
library 'liberouter'
11
11
12
+
13
+ def propagateUserInterupt(err) {
14
+ if (err.getClass() == org.jenkinsci.plugins.workflow.steps.FlowInterruptedException) {
15
+ echo "Detected exception: ${err.toString()}, proceeding to end the whole job..."
16
+ throw err
17
+ } else {
18
+ echo "Detected exception: ${err.toString()}"
19
+ }
20
+ }
21
+
12
22
// Jenkins configuration for multiple modules
13
23
def commonPrekladVerRun(COMPONENTS) {
14
24
@@ -52,6 +62,7 @@ def commonPrekladVerRun(COMPONENTS) {
52
62
}
53
63
}
54
64
} catch(err) {
65
+ propagateUserInterupt(err)
55
66
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
56
67
failed.add("$name")
57
68
} finally { // collect interesting files
@@ -142,13 +153,18 @@ def commonPrekladMultiVerRun(COMPONENTS, ofm_path = pwd()) {
142
153
}
143
154
}
144
155
} catch(err) {
156
+ propagateUserInterupt(err)
145
157
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
146
158
failed.add("$name")
147
159
} finally { // collect interesting files
148
160
archiveArtifacts "$path/transcript*" // verification log
149
161
if (run_coverage_report) {
150
162
// Generate a coverage report file
151
- sh "python3 ${coverage_reporter} --name \"$name\" --input \"$path/coverage_merged.ucdb\" --output \"$path/coverage_report.json\""
163
+ sh(
164
+ script: "python3 ${coverage_reporter} --name \"$name\" --input \"$path/coverage_merged.ucdb\" --output \"$path/coverage_report.json\"",
165
+ returnStatus: true,
166
+ returnStdout: false,
167
+ )
152
168
}
153
169
if(currentBuild.result == "FAILURE") {
154
170
archiveArtifacts "$path/vsim.wlf" // generated waveform, use vsim -view vsim.wlf
@@ -237,6 +253,7 @@ def commonPrekladHarpRun(COMPONENTS, ofm_path = pwd()) {
237
253
}
238
254
}
239
255
} catch(err) {
256
+ propagateUserInterupt(err)
240
257
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
241
258
failed.add("$name")
242
259
} finally { // collect interesting files
@@ -388,6 +405,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
388
405
sh "$command"
389
406
390
407
} catch (err) {
408
+ propagateUserInterupt(err)
391
409
echo "Error detected, firmware build failed!"
392
410
currentBuild.result = 'FAILURE'
393
411
currentStage.result = 'FAILURE'
@@ -401,6 +419,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
401
419
sh "test -f results.xml"
402
420
} catch (err) {
403
421
echo "Error detected, no tests performed (results missing)!"
422
+ propagateUserInterupt(err)
404
423
currentBuild.result = 'FAILURE'
405
424
currentStage.result = 'FAILURE'
406
425
failed.add("$name")
@@ -409,6 +428,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
409
428
}
410
429
}
411
430
} catch(err) {
431
+ propagateUserInterupt(err)
412
432
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
413
433
failed.add("$name")
414
434
} finally { // collect interesting files
@@ -456,44 +476,51 @@ def commonPrekladCocotbMultiVerRun(COMPONENTS, ofm_path = pwd()) {
456
476
457
477
def failed = []
458
478
459
- // run verification of every component
460
- for(c in COMPONENTS) {
461
- // parse
462
- def name = c[0]
463
- def path = c[1]
464
- def settings = c[2]
465
-
466
- def multi_ver = "$ofm_path/build/scripts/multi_ver/multi_ver_cocotb.py"
467
-
468
- // exec vsim
469
- try { // try-catch is a hack to continue even after the first failed verification
470
- timeout(time: 4, unit: 'HOURS') {
471
- stage("cocotb (MULTIVER): $name") {
472
- dir("$path") {
473
- try {
474
- // run multi ver script for cocotb
475
- def command = "python3 $multi_ver $settings"
476
- sh "${print_info}"
477
- sh "$command"
478
-
479
- } catch (err) {
480
- echo "Error detected, firmware build failed!"
481
- currentBuild.result = 'FAILURE'
482
- currentStage.result = 'FAILURE'
483
- failed.add("$name")
479
+ try {
480
+ // run verification of every component
481
+ for(c in COMPONENTS) {
482
+ // parse
483
+ def name = c[0]
484
+ def path = c[1]
485
+ def settings = c[2]
486
+
487
+ def multi_ver = "$ofm_path/build/scripts/multi_ver/multi_ver_cocotb.py"
488
+
489
+ // exec vsim
490
+ try { // try-catch is a hack to continue even after the first failed verification
491
+ timeout(time: 4, unit: 'HOURS') {
492
+ stage("cocotb (MULTIVER): $name") {
493
+ dir("$path") {
494
+ try {
495
+ // run multi ver script for cocotb
496
+ def command = "python3 $multi_ver $settings"
497
+ sh "${print_info}"
498
+ sh "$command"
499
+
500
+ } catch (err) {
501
+ propagateUserInterupt(err)
502
+ echo "Error detected, firmware build failed!"
503
+ currentBuild.result = 'FAILURE'
504
+ currentStage.result = 'FAILURE'
505
+ failed.add("$name")
506
+ }
484
507
}
485
508
}
486
509
}
487
- }
488
- } catch(err) {
489
- currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
490
- failed.add("$name")
491
- } finally { // collect interesting files
492
- archiveArtifacts "$path/transcript" // verification log
493
- if(currentBuild.result == "FAILURE") {
494
- archiveArtifacts "$path/vsim.wlf" // generated waveform, use vsim -view vsim.wlf
510
+ } catch(err) {
511
+ propagateUserInterupt(err)
512
+ currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
513
+ failed.add("$name")
514
+ } finally { // collect interesting files
515
+ archiveArtifacts "$path/transcript" // verification log
516
+ if(currentBuild.result == "FAILURE") {
517
+ archiveArtifacts "$path/vsim.wlf" // generated waveform, use vsim -view vsim.wlf
518
+ }
495
519
}
496
520
}
521
+ } catch(err) {
522
+ echo "Error:"
523
+ echo err.toString()
497
524
}
498
525
499
526
// send out emails if failure is detected
0 commit comments