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.
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 @@
                         }
                     }
                     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 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" )