在Jenkins中使用可编辑电子邮件扩展名进行附件 [英] Attachment using Editable Email Extension in Jenkins
问题描述
我正在使用Jenkins中的可编辑电子邮件插件将文件附加到电子邮件中.问题在于该插件无法找到要附加的文件.
I am using Editable Email plugin in Jenkins to attach a file with the email. The problem is that the plugin is unable to find the file to attach.
我的文件结构是这样的-
报告目录
工作区
My file structure is like this -
ReportDirectory
workspace
ReportDirectory包含我要附加的报告.我相信插件的基本目录是工作空间.所以我给附件位置为 ../ReportDirectory/DemoReport.html. 我也尝试过 ReportDirectory/DemoReport.html
ReportDirectory contains the report which I want to attach. I believe that the base directory for the plugin is the workspace. So I am giving the attachment location as ../ReportDirectory/DemoReport.html. I have also tried ReportDirectory/DemoReport.html
以及更多选项. 我在做错什么吗?
and many more options. Am I doing something wrong?
推荐答案
我知道了.
可编辑电子邮件插件使用Ant文件语法查找附件.当我阅读有关Ant文件语法的文档时( http://ant.apache.org/manual /dirtasks.html ),它表示
The Editable Email plugin uses the Ant File Syntax for locating the attachment. When I took at the documentation for Ant File Syntax ( http://ant.apache.org/manual/dirtasks.html ), it says that
通常,模式被认为是相对于与任务相关的基本目录(在情况下为dir属性)的相对路径.仅考虑在该基本目录下找到的文件.因此,虽然可以使用../foo.java之类的模式,但由于从不扫描基目录的父目录中的文件,因此它在应用时将不匹配任何内容.
In general, patterns are considered relative paths, relative to a task dependent base directory (the dir attribute in the case of ). Only files found below that base directory are considered. So while a pattern like ../foo.java is possible, it will not match anything when applied since the base directory's parent is never scanned for files.
因为在这种情况下,基本目录是工作区",而我的目录"ReportDirectory"不在其中,所以Ant无法访问它.
Since the base directory in this case is the "workspace" and my directory "ReportDirectory" is not located in it so the Ant is not able to access it.
存在两种解决方案:
- 将报告目录"移动到工作区"中的某个位置.我不喜欢这样做,因为我不想弄乱工作区.
- 一旦在"ReportDirectory"中创建了报告,请使用您的Ant \ MSBuild脚本将其临时复制到工作区"中,然后电子邮件插件将可以通过**/Report.html或东西.
@Amey-尽管感谢您的努力:)
@Amey - thanks for your efforts though :)
这篇关于在Jenkins中使用可编辑电子邮件扩展名进行附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!