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

email-ext step fails in freestyle project triggered by workflow plugin buildJob

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: email-ext-plugin
    • Labels:
    • Environment:
      email-ext plugin: 2.40.5
      Jenkins: 1.609.2
      Workflow: 1.8
    • Similar Issues:

      Description

      I have a freestyle job that fails to run the post-build extended email step when it is triggered by a workflow buildJob construct.

      The error message:

      ERROR: Could not send email as a part of the post-build publishers.
      java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowJob cannot be cast to hudson.model.AbstractProject
      	at hudson.plugins.emailext.plugins.recipients.UpstreamComitterRecipientProvider.addRecipients(UpstreamComitterRecipientProvider.java:40)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:578)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:306)
      	at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:297)
      	at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:244)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
      	at hudson.model.Build$BuildExecution.cleanUp(Build.java:193)
      	at hudson.model.Run.execute(Run.java:1788)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:374)
      

        Attachments

          Activity

          Hide
          slide_o_mix Alex Earl added a comment -

          There is a known incompatibility with email-ext and workflow. It's not on my near term radar to fix as its a very invasive change. Work around is to not use the upstream comitters. Other recipient providers may also have issues.

          Show
          slide_o_mix Alex Earl added a comment - There is a known incompatibility with email-ext and workflow. It's not on my near term radar to fix as its a very invasive change. Work around is to not use the upstream comitters. Other recipient providers may also have issues.
          Hide
          jglick Jesse Glick added a comment -

          Fixing this issue should be a quite simple patch. Just do not make this blind cast; skip whatever bit of functionality requires AbstractProject and move on.

          Show
          jglick Jesse Glick added a comment - Fixing this issue should be a quite simple patch. Just do not make this blind cast; skip whatever bit of functionality requires AbstractProject and move on.
          Hide
          slide_o_mix Alex Earl added a comment -

          Yes, this specific issue would be easy to fix, but I'm sure there are other cases that would be nice to fix at the same time.

          Show
          slide_o_mix Alex Earl added a comment - Yes, this specific issue would be easy to fix, but I'm sure there are other cases that would be nice to fix at the same time.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          pom.xml
          src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java
          src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java
          src/test/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProviderTest.java
          http://jenkins-ci.org/commit/email-ext-plugin/4659ead5cd40a48c1b9af4b9253bb6672d210454
          Log:
          Fix JENKINS-29970

          Add check for non-AbstractBuild stuff

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: pom.xml src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java src/test/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProviderTest.java http://jenkins-ci.org/commit/email-ext-plugin/4659ead5cd40a48c1b9af4b9253bb6672d210454 Log: Fix JENKINS-29970 Add check for non-AbstractBuild stuff
          Show
          slide_o_mix Alex Earl added a comment - If you would like, you can try the hpi from here https://jenkins.ci.cloudbees.com/job/plugins/job/email-ext-plugin/lastBuild/org.jenkins-ci.plugins$email-ext/artifact/org.jenkins-ci.plugins/email-ext/2.41-SNAPSHOT/email-ext-2.41-SNAPSHOT.hpi to see if it fixes the issue for you.
          Hide
          slide_o_mix Alex Earl added a comment -

          Will be in 2.41

          Show
          slide_o_mix Alex Earl added a comment - Will be in 2.41

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              david_resnick David Resnick
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: