Reputation: 2652
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 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?
Upvotes: 12
Views: 38751
Reputation: 1
Simple answer: Copy your file into the workspace(into your job directory), then under Attachment, just give the file name without any quotation or anything. This will automatically tell Jenkins to pick up your file. That's it! Pls don't confuse yourself after seeing all the configurations.
Upvotes: 0
Reputation: 2652
I figured it out.
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
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.
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.
Two solutions exist:
@Amey - thanks for your efforts though :)
Upvotes: 13
Reputation: 911
Jenkins will use the directory available in its workspace.
You can send multiple attachments as below.
reportFolder/html/index.html, screenShotsFolder/screenShots/*.jpg
Upvotes: 0
Reputation: 21
Another solution is create a symbolic link from $JENKINS_HOME/jobs/workspace/$workspace_name
to the path with your $workspace_name
. This way worked for me.
Upvotes: 2
Reputation: 8548
ReportDirectory/DemoReport.html
is the correct way to do it.
Please keep in mind that the path to the file and the file name is case sensitive so I assume your entering the correct name.
One more thing is to check is that the report is actually created and is located at the path mentioned by you.
Another thing you could try
ReportDirectory/*
Upvotes: 1