Skip to content

Commit

Permalink
Add support for On Average Trigger Notification
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Jan 17, 2018
1 parent 01c582c commit bc06c98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class SlackNotificationPlugin implements NotificationPlugin {
private static final String TRIGGER_START = "start";
private static final String TRIGGER_SUCCESS = "success";
private static final String TRIGGER_FAILURE = "failure";
private static final String TRIGGER_AVERAGE = "avgduration";

private static final Map<String, SlackNotificationData> TRIGGER_NOTIFICATION_DATA = new HashMap<String, SlackNotificationData>();

Expand Down Expand Up @@ -94,6 +95,7 @@ public boolean postNotification(String trigger, Map executionData, Map config) {
TRIGGER_NOTIFICATION_DATA.put(TRIGGER_START, new SlackNotificationData(ACTUAL_SLACK_TEMPLATE, SLACK_MESSAGE_COLOR_YELLOW));
TRIGGER_NOTIFICATION_DATA.put(TRIGGER_SUCCESS, new SlackNotificationData(ACTUAL_SLACK_TEMPLATE, SLACK_MESSAGE_COLOR_GREEN));
TRIGGER_NOTIFICATION_DATA.put(TRIGGER_FAILURE, new SlackNotificationData(ACTUAL_SLACK_TEMPLATE, SLACK_MESSAGE_COLOR_RED));
TRIGGER_NOTIFICATION_DATA.put(TRIGGER_AVERAGE, new SlackNotificationData(ACTUAL_SLACK_TEMPLATE, SLACK_MESSAGE_COLOR_YELLOW));

try {
FREEMARKER_CFG.setSetting(Configuration.CACHE_STORAGE_KEY, "strong:20, soft:250");
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/templates/slack-incoming-message.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<#assign state="Started">
<#elseif trigger == "failure">
<#assign state="Failed">
<#elseif trigger == "avgduration">
<#assign state="Average exceeded">
<#else>
<#assign state="Succeeded">
</#if>
Expand Down

0 comments on commit bc06c98

Please sign in to comment.