Reputation: 11
As a post build action, have chosen editable email notification option and specified the file path something like **/XXX/index.html. I guess, the job is able to access the file but I don't receive the attachment in the mail.
Email was triggered for: Always Sending email for trigger: Always Sending email to: XXXXX Finished: FAILURE
Can anyone help me to get the attachment along with the mail?
Upvotes: 1
Views: 5622
Reputation: 11
I have done the following, add a build step execute shell.
cd /var/lib/jenkins/jobs/your-job-name/builds/$BUILD_NUMBER/ &&
cp changelog.xml /var/lib/jenkins/workspace/your-job-name/ &&
cd /var/lib/jenkins/workspace/your-job-name/ &&
mv changelog.xml "build-${BUILD_NUMBER}-changelog.xml"
This then copies and renames the change log for the last build in to the workspace, all you need to do then is under attachments within Editable email notification put build-$BUILD_NUMBER-changelog.xml
.
I then run a delete workspace when build is done with an exclude keeping anything important and getting rid of the change logs after they have been sent.
Upvotes: 1
Reputation: 905
The base directory for attachments is the Workspace of the job. Make sure the path you are giving in the Attachments field is relative to the jobs workspace which is $WORKSPACE env variable.
Upvotes: 0