Jenkins email-ext 不发送邮件和输出 "Pre-send script tried to access secured objects"
Jenkins email-ext not sending mails out and output "Pre-send script tried to access secured objects"
用jenkins做CI任务,但是发不出邮件。
这是我的配置:
系统配置如下:
这里是项目邮件配置:
这是输出日志:
Started by user [8mha:////4Nis2K36By9QP5h851e9fPgjtTKHdnnqmcoxBqCGg2BlAAAAmB+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYe/dLi1CL9xLyUotRyAOMeJ3/BAAAA[0mAndrewJia
Building in workspace C:\Program Files (x86)\Jenkins\workspace\EmailTest
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Success
Sending email for trigger: Success
messageContentType = text/plain; charset=UTF-8
Adding recipients from project recipient list
Adding recipients from trigger recipient list
Successfully created MimeMessage
Executing pre-send script
Pre-send script tried to access secured objects: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
ERROR: Could not send email as a part of the post-build publishers.
[8mha:////4CDZUKtxqe4Q69lSu7kc7sXTiWcyvwoa7rJoTRZBvJkKAAAAVx+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0mV3NWzufebKBsTA0NFEYMUmgZnCA1SyAABjCCFBQC2xNaiYAAAAA==[0morg.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedClasspathException: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:577)
at hudson.plugins.emailext.ExtendedEmailPublisher.expandClasspath(ExtendedEmailPublisher.java:671)
at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:613)
at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:566)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:450)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:435)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:343)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
at hudson.model.Run.execute(Run.java:1775)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
Some error occured trying to send the email...check the Jenkins log
Finished: SUCCESS
检查本机服务,以及该用户对jenkins服务的权限。
没有发现奇怪的东西。
我现在不知道这有什么问题。
有谁知道这种情况并告诉我解决方法吗?
谢谢。
为什么在没有 pre 或 post 脚本的情况下会有类路径条目?
如果你正在使用它,你可能需要在脚本安全中批准类路径
请看一下这个问题:
https://issues.jenkins-ci.org/browse/JENKINS-22834
这里实现了这样的功能:
- 管理员定义可信类路径添加
因此,解决方案可能是:
管理员现在可以转到管理 Jenkins » 进程中脚本批准,其中将显示等待批准的脚本列表。假设没有任何看起来危险的请求,只需单击批准让脚本成为 运行 从此以后
(来自 https://wiki.jenkins-ci.org/display/jenkins/script+security+plugin)
用jenkins做CI任务,但是发不出邮件。
这是我的配置: 系统配置如下:
这里是项目邮件配置:
这是输出日志:
Started by user [8mha:////4Nis2K36By9QP5h851e9fPgjtTKHdnnqmcoxBqCGg2BlAAAAmB+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYe/dLi1CL9xLyUotRyAOMeJ3/BAAAA[0mAndrewJia
Building in workspace C:\Program Files (x86)\Jenkins\workspace\EmailTest
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
Checking for post-build
Performing post-build step
Checking if email needs to be generated
Email was triggered for: Success
Sending email for trigger: Success
messageContentType = text/plain; charset=UTF-8
Adding recipients from project recipient list
Adding recipients from trigger recipient list
Successfully created MimeMessage
Executing pre-send script
Pre-send script tried to access secured objects: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
ERROR: Could not send email as a part of the post-build publishers.
[8mha:////4CDZUKtxqe4Q69lSu7kc7sXTiWcyvwoa7rJoTRZBvJkKAAAAVx+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0mV3NWzufebKBsTA0NFEYMUmgZnCA1SyAABjCCFBQC2xNaiYAAAAA==[0morg.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedClasspathException: classpath entry file:/C:/ajia/email-templates/ (4a3bae0a9b9ef3e2342a359514daeccb337beaeb) not yet approved for use
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:577)
at hudson.plugins.emailext.ExtendedEmailPublisher.expandClasspath(ExtendedEmailPublisher.java:671)
at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:613)
at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:566)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:450)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:435)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:343)
at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
at hudson.model.Run.execute(Run.java:1775)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:405)
Some error occured trying to send the email...check the Jenkins log
Finished: SUCCESS
检查本机服务,以及该用户对jenkins服务的权限。 没有发现奇怪的东西。
我现在不知道这有什么问题。 有谁知道这种情况并告诉我解决方法吗?
谢谢。
为什么在没有 pre 或 post 脚本的情况下会有类路径条目? 如果你正在使用它,你可能需要在脚本安全中批准类路径
请看一下这个问题: https://issues.jenkins-ci.org/browse/JENKINS-22834 这里实现了这样的功能:
- 管理员定义可信类路径添加
因此,解决方案可能是:
管理员现在可以转到管理 Jenkins » 进程中脚本批准,其中将显示等待批准的脚本列表。假设没有任何看起来危险的请求,只需单击批准让脚本成为 运行 从此以后 (来自 https://wiki.jenkins-ci.org/display/jenkins/script+security+plugin)