-
Bug
-
Resolution: Incomplete
-
Major
-
windows 2008, Jenkins 1.614, Java 1.7.0_51-b13
-
Powered by SuggestiMate
When automatic e-mails to committers are triggered, the domain name with underscore is added to the mail address.
For example:
Domain user 'domain/user' e-mail should be 'user@mailserver.com', instead, the mail is sent to 'domain_user@mailserver.com'.
[JENKINS-28594] Leading underscore added to committers email address.
can you enable the logger for hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl at the FINE level and see what the logs show for when the address is resolved?
Here is it (I switched my domain and user name with [myDomain] and [myUserName]:
May 28, 2015 4:45:15 PM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl
Failed to look up Active Directory for e-mail address
org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: [myDomain]_[myUserName]
at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220)
at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107)
at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53)
at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54)
at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122)
at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560)
at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32)
at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63)
at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110)
at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130)
at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38)
at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1744)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
How does TFS store your username? Can you add a logger for "hudson.plugins.tfs.model.TfsUserLookup" as well?
I don't know how TFS stores my username.
Adding "hudson.plugins.tfs.model.TfsUserLookup" added the following line before the ActiveDirectoryMailAddressResolverImpl log:
"
May 28, 2015 6:28:37 PM FINE hudson.plugins.tfs.model.TfsUserLookup
Looking up Jenkins user for TFS account '%s'.
"
Oh, that's fantastic...they don't have the value for the account name. What my guess is happening is that the user account name comes in as domain\username, this is passed to the MailAddressResolver, which converts the \ into a _. It doesn't find a user in the Jenkins database with that account and so it can't resolve the address correctly. Can you go to http://YOURSERVER/jenkins/asynchPeople/ and see if there are user accounts in the form of domain_user?
The user IDs are in the form of "domain_user", user accounts are in the form of "domain\user".
You mean in TFS or in Jenkins? If you view one of the people, does the account have a valid email address specified? On a side note, I submitted a PR to fix the logging in the TFS plugin.
Adding a logger for hudson.tasks.MailAddressResolver would be interesting too.
I mean the user IDs on link you sent me (not sure if this means Jenkins or TFS).
If I check the configuration for specific user, it shows the email with the "domain_" prefix.
May 29, 2015 12:23:36 PM FINE hudson.tasks.MailAddressResolver
Resolving e-mail address for "domain\user" ID=domain_user
If you delete the email for one of the users, it would help to see what is setting the email addresses to the domain_user@foo.com (along with adding the logger for hudson.tasks.MailAddressResolver).
Can you delete the user itself from Jenkins?
I'm trying to get the MailAddressResolver to get to this point: https://github.com/jenkinsci/mailer-plugin/blob/master/src/main/java/hudson/tasks/MailAddressResolver.java#L120
Which should tell which MailAddressResolver is resolving the address.
Deleted, still the same...
May 31, 2015 11:52:50 AM FINE hudson.plugins.tfs.model.TfsUserLookup
Looking up Jenkins user for TFS account '%s'.
May 31, 2015 11:52:50 AM FINE hudson.tasks.MailAddressResolver
Resolving e-mail address for "domain_user" ID=domain_user
May 31, 2015 11:52:50 AM FINE hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl
Failed to look up Active Directory for e-mail address
org.acegisecurity.userdetails.UsernameNotFoundException: No such user or group: domain_user
at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.getDnOfUserOrGroup(ActiveDirectoryAuthenticationProvider.java:220)
at hudson.plugins.active_directory.ActiveDirectoryAuthenticationProvider.retrieveUser(ActiveDirectoryAuthenticationProvider.java:107)
at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:53)
at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:54)
at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:122)
at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:560)
at hudson.plugins.tfs.model.TfsUserLookup.find(TfsUserLookup.java:32)
at hudson.plugins.tfs.model.Project.convertServerChangeset(Project.java:63)
at hudson.plugins.tfs.model.Project.getVCCHistory(Project.java:110)
at hudson.plugins.tfs.model.Project.getDetailedHistory(Project.java:130)
at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:38)
at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:214)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1276)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1744)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
If you are willing, could you try the following TFS plugin that fixes the logging to output the actual username? I'm interested in seeing where the username is getting changed to domain_username.
Are you sure the activedirectory plugin is the one returning the addresses? The email-ext plugin uses the MailAddressResolver from Mailer to resolve addresses for users. So, this isn't a bug with email-ext.