Jenkins电子邮件插件不会将电子邮件发送给破坏构建的用户 [英] Jenkins email plugin doesn't send email to user who broke the build
问题描述
我已将Jenkins设置为仅向使用email-ext插件破坏了构建的用户发送电子邮件,但出现此错误:
I've setup Jenkins to send emails only to users who broke the build using email-ext plugin, but I'm getting this error:
不向未注册用户user@example.com发送邮件,因为您的SCM声称这与安全领域无法识别的用户ID"John Smith"相关联;您可能需要在SCM插件中进行更改
Not sending mail to unregistered user user@example.com because your SCM claimed this was associated with a user ID ‘John Smith' which your security realm does not recognize; you may need changes in your SCM plugin
我不太了解此错误的含义,这是我们的SCM还是电子邮件插件中的问题?这些电子邮件是从提交历史记录中提取的,我应该在某个地方注册它们,以便Jenkins可以开始工作吗?
I don't really understand what this error means, is the problem in our SCM, or in the email plugin? The emails are taken from the commit history, should I register them somewhere so Jenkins will start working?
For reference, this is the code around the error message in the plugin's source code:
} catch (UsernameNotFoundException x) {
if (SEND_TO_UNKNOWN_USERS) {
listener.getLogger().printf("Warning: %s is not a recognized user, but sending mail anyway%n", userAddress);
} else {
listener.getLogger().printf("Not sending mail to unregistered user %s because your SCM"
........
如何启用SEND_TO_UNKNOWN_USERS
?
此错误报告中也提到了错误消息.
The error message is also mentioned in this bug report.
推荐答案
好的,经过一些实验,这是我发现的:
OK, after some experiments this is what I found out:
Jenkins接受提交者(而不是作者)的电子邮件部分.例如,对于如下所示的提交消息:
Jenkins takes the email part of the committer (not the author). For example for a commit message that looks like that:
Author: John Smith <author1@example1.com> 2017-07-27 17:15:39
Committer: John Doe <committer1@example2.com> 2017-07-27 17:15:39
Parent: 9c3ff18dda8ca6f7b7ac4ebab4c76d3c85891a33 (commit)
Branch: master
Jenkins将使用"committer1",并在具有用户ID"committer1"和电子邮件"的人员"下创建一个全新的用户.但是,除非该用户具有密码,否则它将被视为未注册,因此您需要转到该用户的配置"并向其添加密码字段:
Jenkins will take "committer1", and create a brand new user under People with User ID "committer1" and email "". Unless that user has a password however, it will be considered unregistered so you need to go to Configure for that user and add a password field to it:
因此,这是解决错误的一种方法,但是您必须为每个用户执行此操作,并且在一个大型团队中,这可能很乏味.
So this is one way to fix the error, but you have to do it for every user and in a big team it can be tedious.
这篇关于Jenkins电子邮件插件不会将电子邮件发送给破坏构建的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!