Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59908

notification-plugin silently fails for WorkflowRun parameters


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • notification-plugin
    • None

      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 

            Unassigned Unassigned
            rverduijn Robin Verduijn
            0 Vote for this issue
            2 Start watching this issue