[JIRA] (JENKINS-59908) notification-plugin silently fails for WorkflowRun parameters

2 views
Skip to first unread message

robinverduijn.github@gmail.com (JIRA)

unread,
Oct 23, 2019, 4:53:03 PM10/23/19
to jenkinsc...@googlegroups.com
Robin Verduijn created an issue
 
Jenkins / Bug JENKINS-59908
notification-plugin silently fails for WorkflowRun parameters
Issue Type: Bug Bug
Assignee: Unassigned
Components: notification-plugin
Created: 2019-10-23 20:52
Priority: Minor Minor
Reporter: Robin Verduijn

The notification-plugin fails to expand tokens, but due to an overly permissive catch block this is not apparent in the build console.

 

Seeing the following in our Jenkins builds when a build notifier is configured:

 

Notifying endpoint with url 'https://jenkins:***@jbroker.xxx.yyy/callback'
Failed to evaluate macro ''  

 

This change modifies the code in question to actually list what sort of Throwable it caught:

diff --git a/src/main/java/com/tikal/hudson/plugins/notification/Phase.java b/src/main/java/com/tikal/hudson/plugins/notification/Phase.java
index 8e758fa..20d4a79 100755
--- a/src/main/java/com/tikal/hudson/plugins/notification/Phase.java
+++ b/src/main/java/com/tikal/hudson/plugins/notification/Phase.java
@@ -243,6 +243,7 @@ public enum Phase {
             // Catching Throwable here because the TokenMacro plugin is optional
             // so will throw a ClassDefNotFoundError if the plugin is not installed or disabled.
             listener.getLogger().println("Failed to evaluate macro '" + text + "'");
+            listener.getLogger().println(e);
         }
         return result;  

 

When running with that, the previously swallowed exception now becomes apparent: it is failing with the following:

 

java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun cannot be cast to hudson.model.AbstractBuild 
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages