简体   繁体   English

如何在Jenkins中将文件附加到电子邮件?

[英]How can I attach a file to the email in Jenkins?

I have a problem now with Jenkins Email. 我现在对詹金斯电子邮件有问题。 I tried to attach a file like demo.html in the $WORKSPACE. 我试图在$ WORKSPACE中附加一个文件demo.html。 But it didn't work. 但这没有用。 I just received an email with build.log attached. 我刚收到一封附有build.log的电子邮件。 Could someone figure out what's the problem? 有人能找出问题所在吗?

I am now doubting that the email is processing in Jenkins master, and my job is working in slave. 我现在怀疑电子邮件是否在Jenkins主服务器中处理,而我的工作是在从属服务器中工作。 Is that the reason? 那是原因吗?

Here is Attachments filed in Editable Email Notification. 这是可编辑电子邮件通知中归档的附件。 I filled it with "*.html" 我用“ * .html”填充

============ ============

Attachments *.html 附件* .html

============ ============

I also tried ./*.html in Attachments field, but with no luck. 我还在附件字段中尝试了./*.html,但是没有运气。

A part of build log: 构建日志的一部分:

completed with result SUCCESS

Checking if email needs to be generated

Email was triggered for: Success

Sending email for trigger: Success

NOT overriding default server settings, using Mailer to create session

messageContentType = text/plain; charset=UTF-8

Request made to attach build log

Adding recipients from recipient list

Adding developers

Successfully created MimeMessage

Sending email to: test999922@hotmail.com

Finished: SUCCESS

I found the reason. 我找到了原因。 The html is in the salve's workspace not in master's workspace. html在从属服务器的工作空间中,而不在主服务器的工作空间中。 So jenkins cannot find it. 因此詹金斯找不到它。 When I restrict it run on slave, the problem is resolved. 当我限制它在从属服务器上运行时,该问题得以解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM