Skip to content

Commit

Permalink
Necessary changes for the jenkinsci#169 merge into master
Browse files Browse the repository at this point in the history
  • Loading branch information
KreAch3R committed Jul 22, 2018
1 parent 10b03da commit dc448b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/main/java/jenkins/plugins/slack/ActiveNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,21 @@ public MessageBuilder appendFailedTests() {
return this;
}

public MessageBuilder appendCustomMessage() {
String customMessage = notifier.getCustomMessage();
EnvVars envVars = new EnvVars();
try {
envVars = build.getEnvironment(new LogTaskListener(logger, INFO));
} catch (IOException e) {
logger.log(SEVERE, e.getMessage(), e);
} catch (InterruptedException e) {
logger.log(SEVERE, e.getMessage(), e);
}
message.append("\n");
message.append(envVars.expand(customMessage));
return this;
}

public MessageBuilder appendCustomMessage(Result buildResult) {
String customMessage = notifier.getCustomMessage(buildResult);
EnvVars envVars = new EnvVars();
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/jenkins/plugins/slack/SlackNotifierTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public SlackNotifierTest(SlackServiceStub slackServiceStub, boolean response, Fo
customMessageMap.put("ABORTED", "This is the Aborted Result Message");
customMessageMap.put("FAILURE", "This is the Failure Result Message");

this.slackNotifier = new SlackNotifierStub( "teamDomain", "authToken", true, "room", "buildServerUrl", "sendAs", true, true, true, true, true, true, true, true, false, false, CommitInfoChoice.NONE, true, "Custom Message String", customMessageMap);
this.slackNotifier = new SlackNotifierStub("baseUrl", "teamDomain", "authToken", true, "room", "buildServerUrl", "sendAs", true, true,
true, true, true, true, false, true, true, false, false, CommitInfoChoice.NONE, true, "Custom Message String", customMessageMap);
}

@Parameterized.Parameters
Expand Down

0 comments on commit dc448b8

Please sign in to comment.