This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git
The following commit(s) were added to refs/heads/feature/SLING-7245 by this
push:
new 68d72cb SLING-7245 - Validate pull requests using Jenkins
68d72cb is described below
commit 68d72cb288558082898d185274cf0d2e9370106f
Author: Robert Munteanu <[email protected]>
AuthorDate: Thu Dec 20 16:46:05 2018 +0100
SLING-7245 - Validate pull requests using Jenkins
Manually set the result since the 'currentResult' field seems to be
set to 'SUCCESS' when we check it in the finally block.
---
vars/slingOsgiBundleBuild.groovy | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 998267e..33024c1 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -72,10 +72,15 @@ def call(Map params = [:]) {
}
}
reference = false
+ currentBuild.result = "SUCCESS"
}
} else {
echo "Job is disabled, not building"
}
+ } catch (Exception e) {
+ // TODO - how to handle aborted builds?
+ currentBuild.result = "FAILURE"
+ throw e
} finally {
processResult(currentBuild,
currentBuild.getPreviousBuild()?.result)
}
@@ -84,12 +89,12 @@ def call(Map params = [:]) {
def processResult(def currentBuild, String previous) {
- String current = currentBuild.currentResult
+ String current = currentBuild.result
// values described at
https://javadoc.jenkins-ci.org/hudson/model/Result.html
// Note that we don't handle consecutive failures to prevent mail spamming
- echo "Result status : ${current}, previous: ${previous}"
+ echo "Result : ${current}, previous: ${previous}"
// 1. changes from success or unknown to non-success
if ( (previous == null || previous == "SUCCESS") && current != "SUCCESS" )