From ad3ba4b6e2f53772c3ca855789bb5bf8e0fc25db Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Thu, 1 Jun 2017 22:52:02 +0200 Subject: [PATCH] [Jenkinsfile] Mark build as unstable if tests fail on *nix or get interrupted (incl. timeout). --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0df7bdc8..9e79f01c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -159,6 +159,16 @@ def doUnitTests(name) { } } } + } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { + currentBuild.result = 'UNSTABLE' + println("${name} unit test interrupted (ran too long?)") + } catch (Exception e) { + println("${name} unit test failed.") + if (isUnix()) { + currentBuild.result = 'UNSTABLE' + } else { + throw e + } } finally { // In all cases make sure to at least remove the directory junctions! if (!isUnix()) {