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 

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

          Dani added a comment -

          Hi Robin,

          I am also getting the same error.

          Did you manage to resolve this issue? If yes, how? Is this a plugin version issue?

          Thanks,

          Dani.

          Dani added a comment - Hi Robin, I am also getting the same error. Did you manage to resolve this issue? If yes, how? Is this a plugin version issue? Thanks, Dani.

          Robin Verduijn added a comment - - edited

          Yes, the issue is fixed by https://github.com/jenkinsci/notification-plugin/pull/38 

          I am trying to get upstream to reopen it so it can be merged.

           

          There is no newer plugin available yet which would fix it, but once the above changes are merged it should resolve the issue.

          Robin Verduijn added a comment - - edited Yes, the issue is fixed by https://github.com/jenkinsci/notification-plugin/pull/38   I am trying to get upstream to reopen it so it can be merged.   There is no newer plugin available yet which would fix it, but once the above changes are merged it should resolve the issue.

          Dani added a comment -

          Thanks Robin!

          I hope the PR gets merged pretty soon. I see you are waiting to get the PR merge.

          Another qq - We have an older version of this plugin (1.1) in our other Jenkins environment; but that works fine though. (but the Jenkins version is also old there).

          Is this introduced in the current latest version ? I am thinking to downgrade the plugin and see if the issue gets resolved.

          Thanks,

          Dani.

          Dani added a comment - Thanks Robin! I hope the PR gets merged pretty soon. I see you are waiting to get the PR merge. Another qq - We have an older version of this plugin (1.1) in our other Jenkins environment; but that works fine though. (but the Jenkins version is also old there). Is this introduced in the current latest version ? I am thinking to downgrade the plugin and see if the issue gets resolved. Thanks, Dani.

          My hunch would be that the breakage was due to a newer Jenkins core version that the plugin did not properly support, but it might be worth downgrading the plugin to see if that makes any difference.

          Robin Verduijn added a comment - My hunch would be that the breakage was due to a newer Jenkins core version that the plugin did not properly support, but it might be worth downgrading the plugin to see if that makes any difference.

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

              Created:
              Updated: