jira-plugin icon indicating copy to clipboard operation
jira-plugin copied to clipboard

Enabling Jira plugin breaks Extend E-Mail plugin

Open AlexSchultz-clumio opened this issue 2 years ago • 2 comments

Your checklist for this issue

🚨 Please review the guidelines for contributing to this repository.

  • [X] Jenkins version
  • [X] Plugin version
  • [X] OS

Versions:

Jenkins 2.332.1
Jira Plugin 3.7
Email Extension 2.87
Debian 11

Issue:

Similar to https://issues.jenkins.io/browse/JENKINS-62713 we're seeing the Extended E-Mail plugin broken because the email resolver is failing with

Jira REST client get user error. cause: RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={}, errorMessages=[The 'accountId' query parameter needs to be provided]}]}
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={}, errorMessages=[The 'accountId' query parameter needs to be provided]}]}

We are running the plugin version with the patch referenced in the Jenkins issue.

Looks like a workaround would be to disable the email resovler with "-Dhudson.plugins.jira.JiraMailAddressResolver.disabled=true" per https://github.com/jenkinsci/jira-plugin/blob/master/src/main/java/hudson/plugins/jira/JiraMailAddressResolver.java#L26 however I have not tested this.

Reproduction steps

  • Configure Jira plugin
  • Configure Extended E-Mail plugin
  • Attempt to send an email

Results

Expected result:

Email is successfully sent and no exception is thrown

Actual result:

Exception is thrown

Jira REST client get user error. cause: RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={}, errorMessages=[The 'accountId' query parameter needs to be provided]}]}
RestClientException{statusCode=Optional.of(400), errorCollections=[ErrorCollection{status=400, errors={}, errorMessages=[The 'accountId' query parameter needs to be provided]}]}
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:176)
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:170)
	at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:49)
	at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:10)
	at io.atlassian.util.concurrent.Promises$OfStage.lambda$fold$4(Promises.java:332)
	at io.atlassian.util.concurrent.Promises.lambda$biFunction$7(Promises.java:422)
	at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:930)
	at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:907)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)
	at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:910)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
	at com.atlassian.httpclient.apache.httpcomponents.CompletableFuturePromiseHttpPromiseAsyncClient.runInContext(CompletableFuturePromiseHttpPromiseAsyncClient.java:89)
	at com.atlassian.httpclient.apache.httpcomponents.CompletableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable.run(CompletableFuturePromiseHttpPromiseAsyncClient.java:170)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused: java.util.concurrent.ExecutionException
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2022)
	at io.atlassian.util.concurrent.Promises$OfStage.get(Promises.java:357)
	at com.atlassian.jira.rest.client.internal.async.DelegatingPromise.get(DelegatingPromise.java:106)
	at hudson.plugins.jira.JiraRestService.getUser(JiraRestService.java:321)
	at hudson.plugins.jira.JiraMailAddressResolver.findMailAddressFor(JiraMailAddressResolver.java:52)
	at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122)
	at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:762)
	at hudson.plugins.emailext.EmailRecipientUtils.getUserConfiguredEmail(EmailRecipientUtils.java:110)
	at hudson.plugins.emailext.plugins.recipients.RecipientProviderUtilities.addUsers(RecipientProviderUtilities.java:166)
	at hudson.plugins.emailext.plugins.recipients.RecipientProviderUtilities.addUsers(RecipientProviderUtilities.java:152)
	at hudson.plugins.emailext.plugins.recipients.BuildUserRecipientProvider.addUserTriggeringTheBuild(BuildUserRecipientProvider.java:64)
	at hudson.plugins.emailext.plugins.recipients.BuildUserRecipientProvider.addRecipients(BuildUserRecipientProvider.java:56)
	at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:926)
	at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:494)
	at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:444)
	at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:354)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:763)
	at hudson.model.Build$BuildExecution.cleanUp(Build.java:189)
	at hudson.model.Run.execute(Run.java:1943)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)

AlexSchultz-clumio avatar Jun 24 '22 20:06 AlexSchultz-clumio

Thanks for reporting this and doing research. Indeed the workaround to disable the resolver should work.

For me to try to reproduce this, what Jira version are you connecting to?

rantoniuk avatar Jun 25 '22 10:06 rantoniuk

In this instance it's the hosted cloud ira on atlassian.com. https://www.atlassian.com/software/jira/pricing it's likely reproducible with the free tier

AlexSchultz-clumio avatar Jun 25 '22 17:06 AlexSchultz-clumio

This might be the same root cause as #474

rantoniuk avatar Nov 30 '23 11:11 rantoniuk

Closing since #474 was fixed - if this is still happening for anyone, please open a new issue with a plugin versions report to help reproducing it.

rantoniuk avatar Jan 03 '24 11:01 rantoniuk