Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to send xml files as an attachment with notification email in hudson

 
avneet kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a configured a project in hudson which is generating certain xml files after its execution.I want to attach those file with the notification email being sent after the project's execution.I have installed email-ext plugin but no such option is there.

Please help me out in configuring this.


Thanks in advance
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the docs: http://wiki.hudson-ci.org/display/HUDSON/Email-ext+plugin
Note especially this text in the docs:
email-ext wrote:To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen.

Then following this step, you will see a number of tokens you can insert, including:
email-ext wrote:${FILE, path} - Includes the content of a specified file.
path - The path to the file. Relative to the workspace root.
 
avneet kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter,

I will try to implement this & will let you know the results
 
avneet kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,

Can you please throw some light on how to setup this token & its corresponding value in project configuration in hudson.
I am facing some problem on setting up this
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tired so far and what has the result been?
 
avneet kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,

Is it possible to send a file as an attachment with the Hudson mail notification.

We are trying it with email-ext plugin but the attachment is not coming with the mail, It is simply send the defined parameters as a message in the mail.



You can also find an attachment with this post.


Thanks,
Avneet
hudson_mail.JPG
[Thumbnail for hudson_mail.JPG]
Email notification parameters
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly where is index.html located? Is it within your project? Is it located somewhere on the Hudson server? Is it located somewhere on the build slave?
 
avneet kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This index.html is located in the workspace of hudson...I am just executing simple scenario with hudson only as master...no slave is there....
& this workspace is in the VM machine where hudson is.Here is the path: /root/.hudson/jobs/test/workspace
 
Mahendra Singh India
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please suggest me how to use FILE token. I am specifying as what is mentioned in previous post.
my file is present under workspace

I am using :${FILE="pom.xml", path="file path"}.
Its not working. Please suggest on with an example
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on reading the help text, I would have though that you would use something like this:

${FILE, pom.xml}
 
Mahendra Singh India
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
I have tried with given option as well.
Its simply printing the same in the body part of the mail.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figure it out.

There is this phrase in the help text regarding the path: "Relative to the workspace root." So the question becomes, what is "the workspace root?" Well, looking at the ~/.hudson/jobs directory, I noticed that for job Foo Bar, there was this directory structure:

~/.hudson/jobs/Foo Bar/workspace/foobar

That last foobar is the project directory from Subversion, and it is that foobar directory that contains my project (that it the Mavne or Ant build script resides there and it is basedir for the builds. However, foobar is not "the workspace root." Instead, the workspace directory is the workspace root.

The other thing I had to figure out is that the syntax for the properties is not well documented. It should really say:

${FILE, path="xxx"} where xxx is the relative path to the file

Thus this worked for me:

${FILE, path="foobar/pom.xml"}

I received an email with the contents of the POM.
 
Mahendra Singh India
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,

Thanks for the configuration suggested.
It is working fine for me as well.
I am also getting the file as the content. Is there any option by which we can get the file as an attachment.

Regards,
Mahendra
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any option by which we can get the file as an attachment.

Not that I know of. But the plugin is open source, you could always add that capability and submit the patch back to the community.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic