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
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.12.1</version>
</dependency>
</dependencies>
</project>
9 changes: 8 additions & 1 deletion src/main/java/com/flowdock/jenkins/FlowdockNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException;
import org.jenkinsci.plugins.tokenmacro.TokenMacro;

import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -122,7 +124,8 @@ public boolean shouldNotify(BuildResult buildResult) {
protected void notifyFlowdock(AbstractBuild build, BuildResult buildResult, BuildListener listener) {
PrintStream logger = listener.getLogger();
try {
FlowdockAPI api = new FlowdockAPI(getDescriptor().apiUrl(), flowToken);
String parsedFlowToken = TokenMacro.expandAll(build, listener, flowToken);
FlowdockAPI api = new FlowdockAPI(getDescriptor().apiUrl(), parsedFlowToken);
TeamInboxMessage msg = TeamInboxMessage.fromBuild(build, buildResult, listener);
EnvVars vars = build.getEnvironment(listener);
msg.setTags(vars.expand(notificationTags));
Expand Down Expand Up @@ -152,6 +155,10 @@ protected void notifyFlowdock(AbstractBuild build, BuildResult buildResult, Buil
logger.println("Flowdock: " + ex.getMessage());
}

catch(MacroEvaluationException ex) {
logger.println("Error evaluating token: " + ex.getMessage());
}


}

Expand Down