Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dist/jenkins-flowdock-plugin.hpi
Binary file not shown.
4 changes: 4 additions & 0 deletions src/main/java/com/flowdock/jenkins/ChatMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static ChatMessage fromBuild(AbstractBuild build, BuildResult buildResult
String buildNo = build.getDisplayName().replaceAll("#", "");
content.append(projectName + configuration).append(" build ").append(buildNo);
content.append(" ").append(buildResult.getHumanResult());
if (build.getResult() == build.getPreviousBuild().getResult()) {
content.append(" still");
}
content.append(".");

String rootUrl = Hudson.getInstance().getRootUrl();
String buildLink = (rootUrl == null) ? null : rootUrl + build.getUrl();
Expand Down
28 changes: 23 additions & 5 deletions src/main/java/com/flowdock/jenkins/FlowdockNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,29 @@ protected void notifyFlowdock(AbstractBuild build, BuildResult buildResult, Buil
api.pushTeamInboxMessage(msg);
listener.getLogger().println("Flowdock: Team Inbox notification sent successfully");

if(build.getResult() != Result.SUCCESS && chatNotification) {
ChatMessage chatMsg = ChatMessage.fromBuild(build, buildResult, listener);
chatMsg.setTags(vars.expand(notificationTags));
api.pushChatMessage(chatMsg);
logger.println("Flowdock: Chat notification sent successfully");
if (chatNotification) {
String importanceIcon = null;
switch (buildResult) {
case FAILURE:
importanceIcon = ":exclamation:";
break;
case FIXED:
importanceIcon = ":white_check_mark:";
break;
case UNSTABLE:
importanceIcon = ":grey_exclamation:";
break;
default:
break;
}

if (importanceIcon != null) {
ChatMessage chatMsg = ChatMessage.fromBuild(build, buildResult, listener);
chatMsg.setTags(vars.expand(notificationTags));
chatMsg.setContent(importanceIcon + " " + chatMsg.content);
api.pushChatMessage(chatMsg);
logger.println("Flowdock: Chat notification sent successfully");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
title="Test connection with Chat notification" progress="Sending..."
method="testConnection" with="flowToken,notificationTags" />

<f:entry title="Chat notification when build fails" field="chatNotification">
<f:entry title="Chat notification when build fails, becomes instable or returns to stable" field="chatNotification">
<f:checkbox />
</f:entry>

Expand Down