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

93 views
Skip to first unread message

David Resnick

unread,
Jul 29, 2015, 9:23:01 AM7/29/15
to Jenkins Users
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)

It seems that it might be able to succeed if I remove some of the categories I chose to send to, though I have not yet experimented with this.

Is there a known workaround for this problem? Would it be helpful for me to open a bug for this?

Thanks,
David

Slide

unread,
Jul 29, 2015, 9:26:36 AM7/29/15
to Jenkins Users
This is a known incompatibility between workflow and email-ext. Email-ext expects projects to be based on AbstractProject and Workflow is not.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cbf83da3-943d-4a91-a8e2-8dd389175c20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Resnick

unread,
Jul 29, 2015, 9:52:42 AM7/29/15
to Jenkins Users, slide...@gmail.com
Is there any plan to bridge this divide? I notice that it pops up fairly often whenever the workflow plugin is in the picture.

- David

Slide

unread,
Jul 29, 2015, 9:54:25 AM7/29/15
to David Resnick, Jenkins Users

It's not on my near term radar sadly, but I hope to get to it this year if no one else does it and creates a pull request.

Jesse Glick

unread,
Aug 12, 2015, 5:11:16 PM8/12/15
to Jenkins Users
On Wednesday, July 29, 2015 at 9:23:01 AM UTC-4, David Resnick wrote:
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)

Email Ext is not currently supported *from* a Workflow project, and that is a deep topic. But it is clearly a straightforward bug in that plugin that it does a blind cast of the *upstream* project. If it cannot handle an arbitrary `Job` here, it should print a warning and move on. File it please, label `workflow`.

David Resnick

unread,
Aug 16, 2015, 4:44:18 AM8/16/15
to Jenkins Users
Reply all
Reply to author
Forward
0 new messages