From 9ff454eee32fcbb16bceeaaa6f00258e2d7c3945 Mon Sep 17 00:00:00 2001 From: GabKlein Date: Fri, 12 Jul 2013 18:38:39 -0400 Subject: [PATCH] Add custom message variable --- src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java b/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java index 6576ec3..6e01373 100644 --- a/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/hipchat/ActiveNotifier.java @@ -1,5 +1,6 @@ package jenkins.plugins.hipchat; +import hudson.EnvVars; import hudson.Util; import hudson.model.*; import hudson.scm.ChangeLogSet; @@ -168,6 +169,13 @@ private MessageBuilder startMessage() { message.append(build.getProject().getDisplayName()); message.append(" - "); message.append(build.getDisplayName()); + EnvVars env = new EnvVars(build.getBuildVariables()); + String hipchatMsg = env.get("HIPCHAT_MSG"); + if (hipchatMsg != null && !hipchatMsg.isEmpty()) { + message.append(" - "); + message.append(hipchatMsg); + message.append(" - "); + } message.append(" "); return this; }