From c4111aba255b88dfc75ffaef8bbce5071c341e9f Mon Sep 17 00:00:00 2001 From: aabrahamian Date: Sun, 11 Mar 2018 16:46:57 -0700 Subject: [PATCH] Duration of concurrent builds fix Duration of concurrent builds should always just be the duration not the time since the last success. --- pom.xml | 2 +- src/main/java/jenkins/plugins/slack/ActiveNotifier.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 1e4dd059..f81ec00e 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ slack hpi - 2.4-SNAPSHOT + 2.4-SNAPSHOT-alex-2018-03-11-01 Slack Notification Plugin A Build status publisher that notifies channels on a Slack team http://wiki.jenkins-ci.org/display/JENKINS/Slack+Plugin diff --git a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java index 0018aef8..e1cf130d 100755 --- a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java @@ -256,7 +256,7 @@ static String getBuildColor(AbstractBuild r) { String getBuildStatusMessage(AbstractBuild r, boolean includeTestSummary, boolean includeFailedTests, boolean includeCustomMessage) { MessageBuilder message = new MessageBuilder(notifier, r); message.appendStatusMessage(); - message.appendDuration(); + message.appendDuration(r.getProject().isConcurrentBuild()); message.appendOpenLink(); if (includeTestSummary) { message.appendTestSummary(); @@ -389,10 +389,10 @@ public MessageBuilder appendOpenLink() { return this; } - public MessageBuilder appendDuration() { + public MessageBuilder appendDuration(boolean isConcurrentBuild) { message.append(" after "); String durationString; - if(message.toString().contains(BACK_TO_NORMAL_STATUS_MESSAGE)){ + if(!isConcurrentBuild && message.toString().contains(BACK_TO_NORMAL_STATUS_MESSAGE)){ durationString = createBackToNormalDurationString(); } else { durationString = build.getDurationString();