From 9e38d440b3585ad18abe3e2c3de24f7a35735ed3 Mon Sep 17 00:00:00 2001 From: George G Date: Mon, 17 Dec 2018 01:25:11 +0200 Subject: [PATCH] Don't publish twice, while the build isn't finished yet Without this patch: ``` test - #23 Started by user admin (Open) test - #23 Success after 12 sec and counting (Open) test - #23 Success after 13 sec (Open) ``` With this patch: ``` test - #27 Started by user admin (Open) test - #27 Success after 12 sec (Open) ``` --- src/main/java/jenkins/plugins/slack/ActiveNotifier.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java index cfa5c911..619feedd 100755 --- a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java @@ -104,7 +104,7 @@ public void finalized(AbstractBuild r) { AbstractProject project = r.getProject(); Result result = r.getResult(); AbstractBuild previousBuild = project.getLastBuild(); - if (null != previousBuild) { + if (null != previousBuild && !r.isBuilding()) { do { previousBuild = previousBuild.getPreviousCompletedBuild(); } while (previousBuild != null && previousBuild.getResult() == Result.ABORTED); @@ -123,7 +123,7 @@ public void completed(AbstractBuild r) { AbstractProject project = r.getProject(); Result result = r.getResult(); AbstractBuild previousBuild = project.getLastBuild(); - if (null != previousBuild) { + if (null != previousBuild && !r.isBuilding()) { do { previousBuild = previousBuild.getPreviousCompletedBuild(); } while (null != previousBuild && previousBuild.getResult() == Result.ABORTED);