使用jenkins进行CI任务,但无法发送邮件。
这是我的配置: 系统配置如下: enter image description here
这是项目邮件配置: enter image description here
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$1.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服务的许可。 没有发现任何奇怪的事情。
我现在不知道这有什么问题。 有人能够知道这种情况并告诉我解决方案吗?
感谢。
答案 0 :(得分:1)
请看一下这个问题: https://issues.jenkins-ci.org/browse/JENKINS-22834 这里实现了这样的功能:
所以,解决办法可能是:
管理员现在可以转到管理Jenkins»进程内脚本批准,其中将显示待批准的脚本列表。假设没有请求任何危险的东西,只需单击批准让脚本从此运行 (来自https://wiki.jenkins-ci.org/display/jenkins/script+security+plugin)
答案 1 :(得分:0)
为什么没有前脚本或后脚本时会有类路径条目? 如果使用
,则可能需要在脚本安全性中批准类路径