Skip to content

Commit a886f0f

Browse files
committed
Fixes #26
Adding the colors to the attachments as good, warning or danger based on the various states of the pipeline
1 parent a676fe7 commit a886f0f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/in/ashwanthkumar/gocd/slack/SlackPipelineListener.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,31 @@ public void onBuilding(PipelineRule rule, GoNotificationMessage message) throws
3737
@Override
3838
public void onPassed(PipelineRule rule, GoNotificationMessage message) throws Exception {
3939
updateSlackChannel(rule.getChannel());
40-
slack.push(slackAttachment(message, PipelineStatus.PASSED));
40+
slack.push(slackAttachment(message, PipelineStatus.PASSED).color("good"));
4141
}
4242

4343
@Override
4444
public void onFailed(PipelineRule rule, GoNotificationMessage message) throws Exception {
4545
updateSlackChannel(rule.getChannel());
46-
slack.push(slackAttachment(message, PipelineStatus.FAILED));
46+
slack.push(slackAttachment(message, PipelineStatus.FAILED).color("danger"));
4747
}
4848

4949
@Override
5050
public void onBroken(PipelineRule rule, GoNotificationMessage message) throws Exception {
5151
updateSlackChannel(rule.getChannel());
52-
slack.push(slackAttachment(message, PipelineStatus.BROKEN));
52+
slack.push(slackAttachment(message, PipelineStatus.BROKEN).color("danger"));
5353
}
5454

5555
@Override
5656
public void onFixed(PipelineRule rule, GoNotificationMessage message) throws Exception {
5757
updateSlackChannel(rule.getChannel());
58-
slack.push(slackAttachment(message, PipelineStatus.FIXED));
58+
slack.push(slackAttachment(message, PipelineStatus.FIXED).color("good"));
5959
}
6060

6161
@Override
6262
public void onCancelled(PipelineRule rule, GoNotificationMessage message) throws Exception {
6363
updateSlackChannel(rule.getChannel());
64-
slack.push(slackAttachment(message, PipelineStatus.CANCELLED));
64+
slack.push(slackAttachment(message, PipelineStatus.CANCELLED).color("warning"));
6565
}
6666

6767
private SlackAttachment slackAttachment(GoNotificationMessage message, PipelineStatus pipelineStatus) throws URISyntaxException {

0 commit comments

Comments
 (0)