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,6 +153,7 @@ 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
@@ -241,6 +253,7 @@ def commonPrekladHarpRun(COMPONENTS, ofm_path = pwd()) {
241
253
}
242
254
}
243
255
} catch(err) {
256
+ propagateUserInterupt(err)
244
257
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
245
258
failed.add("$name")
246
259
} finally { // collect interesting files
@@ -392,6 +405,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
392
405
sh "$command"
393
406
394
407
} catch (err) {
408
+ propagateUserInterupt(err)
395
409
echo "Error detected, firmware build failed!"
396
410
currentBuild.result = 'FAILURE'
397
411
currentStage.result = 'FAILURE'
@@ -405,6 +419,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
405
419
sh "test -f results.xml"
406
420
} catch (err) {
407
421
echo "Error detected, no tests performed (results missing)!"
422
+ propagateUserInterupt(err)
408
423
currentBuild.result = 'FAILURE'
409
424
currentStage.result = 'FAILURE'
410
425
failed.add("$name")
@@ -413,6 +428,7 @@ def commonPrekladCocotbVerRun(COMPONENTS) {
413
428
}
414
429
}
415
430
} catch(err) {
431
+ propagateUserInterupt(err)
416
432
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
417
433
failed.add("$name")
418
434
} finally { // collect interesting files
@@ -460,44 +476,51 @@ def commonPrekladCocotbMultiVerRun(COMPONENTS, ofm_path = pwd()) {
460
476
461
477
def failed = []
462
478
463
- // run verification of every component
464
- for(c in COMPONENTS) {
465
- // parse
466
- def name = c[0]
467
- def path = c[1]
468
- def settings = c[2]
469
-
470
- def multi_ver = "$ofm_path/build/scripts/multi_ver/multi_ver_cocotb.py"
471
-
472
- // exec vsim
473
- try { // try-catch is a hack to continue even after the first failed verification
474
- timeout(time: 4, unit: 'HOURS') {
475
- stage("cocotb (MULTIVER): $name") {
476
- dir("$path") {
477
- try {
478
- // run multi ver script for cocotb
479
- def command = "python3 $multi_ver $settings"
480
- sh "${print_info}"
481
- sh "$command"
482
-
483
- } catch (err) {
484
- echo "Error detected, firmware build failed!"
485
- currentBuild.result = 'FAILURE'
486
- currentStage.result = 'FAILURE'
487
- 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
+ }
488
507
}
489
508
}
490
509
}
491
- }
492
- } catch(err) {
493
- currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
494
- failed.add("$name")
495
- } finally { // collect interesting files
496
- archiveArtifacts "$path/transcript" // verification log
497
- if(currentBuild.result == "FAILURE") {
498
- 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
+ }
499
519
}
500
520
}
521
+ } catch(err) {
522
+ echo "Error:"
523
+ echo err.toString()
501
524
}
502
525
503
526
// send out emails if failure is detected
0 commit comments