This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/master by this push:
     new ef7ce02  [jenkinsfile] last() cannot be called on []
ef7ce02 is described below

commit ef7ce0288bb868c9182a78c9bf8bdbdf07cf7448
Author: tibordigana <[email protected]>
AuthorDate: Fri Aug 2 21:47:43 2019 +0200

    [jenkinsfile] last() cannot be called on []
---
 Jenkinsfile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index fb34641..681b33a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -112,10 +112,10 @@ timeout(time: 12, unit: 'HOURS') {
         currentBuild.result = 'FAILURE'
         throw e
     } finally {
-        def isFirstBuild = currentBuild == null || currentBuild.changeSets == 
null
-        def authors = isFirstBuild ? [] : 
currentBuild.changeSets.last().toList().collect { it.author.toString() 
}.unique()
+        def changes = currentBuild?.changeSets
+        def authors = !changes || changes.isEmpty() ? [] : 
changes.last().toList().collect { it.author.toString() }.unique()
         println("The author of the last change: ${authors}")
-        if (isFirstBuild || !authors.contains('github')) jenkinsNotify()
+        if (!changes || !authors.contains('github')) jenkinsNotify()
     }
 }
 

Reply via email to