How to configure ant pattern in jenkins for email attachments?

9,983 views
Skip to first unread message

Rakesh Manoharan

unread,
Jan 6, 2015, 11:24:26 PM1/6/15
to jenkin...@googlegroups.com
I am trying to give the following ant pattern for attachments in editable email notification plugin.

I believe my base directory could be /var/lib/jenkins/workspace/

<fileset dir="error/*" casesensitive="yes">   <include name="**/*.log.gz"/>  </fileset>

I have  error.log.gz file in directory /var/lib/jenkins/workspace/error/

After doing this the email is coming with no attachments. Can some one please tell where its going wrong, or could you please share a sample ant xml pattern for attachments in jenkins?

I have also tried the following pattern 

<attachments>
  <fileset dir="dist">
    <include name="**/*.gz" />
  </fileset>
</attachments>

Slide

unread,
Jan 7, 2015, 8:00:18 AM1/7/15
to jenkin...@googlegroups.com
You just need to put the pattern into the textbox, nothing else. "**/*.log.gz" should be all you need

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/196ae0cb-5997-4e12-9ab5-01630de4cb4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rakesh Manoharan

unread,
Jan 8, 2015, 8:25:53 AM1/8/15
to jenkin...@googlegroups.com
Thanks, but that also didnt work, any other suggestions

Slide

unread,
Jan 8, 2015, 10:52:23 AM1/8/15
to jenkin...@googlegroups.com
Perhaps you could supply your config.xml for the job, or screenshots or something. We're kind of flying blindly at this point.

Rakesh Manoharan

unread,
Jan 8, 2015, 10:55:27 PM1/8/15
to jenkin...@googlegroups.com
Sorry about that, please find the attached config file.
config.xml

Slide

unread,
Jan 9, 2015, 10:44:32 AM1/9/15
to jenkin...@googlegroups.com
Please remove the quotes from the pattern and see if that works.

Rakesh Manoharan

unread,
Jan 12, 2015, 1:01:34 AM1/12/15
to jenkin...@googlegroups.com
Thanks, but that also didn't work :(

Slide

unread,
Jan 12, 2015, 9:25:29 AM1/12/15
to jenkin...@googlegroups.com

OK, please enable debug mode in the global configuration for email-ext, it should add some info about attachments.


Rakesh Manoharan

unread,
Jan 12, 2015, 9:54:49 AM1/12/15
to jenkin...@googlegroups.com
It would be great, if you can tell me how can I enable debug in that plugin?

Slide

unread,
Jan 12, 2015, 9:58:37 AM1/12/15
to jenkin...@googlegroups.com

In the global configuration there is a check box to enable debug mode


Rakesh Manoharan

unread,
Jan 12, 2015, 10:03:18 AM1/12/15
to jenkin...@googlegroups.com
Started by user Rakesh Manoharan
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/workspace/ErrorLogNotifications
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
[ErrorLogNotifications] $ /bin/sh -xe /tmp/hudson1929319248867282733.sh
+ cd /usr/local/EnterprisePlatform-5.1.0/jboss-eap-5.1/jboss-as/server/dev1a/log/
+ cat server.log
+ grep ERROR
+ mv error.txt /var/lib/jenkins/jobs/
Checking for post-build
Performing post-build step
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/html; charset=UTF-8
Adding recipients from recipient list
Successfully created MimeMessage
Sending email to: rmano...@mcfadyen.com
Finished: SUCCESS

Slide

unread,
Jan 12, 2015, 10:06:56 AM1/12/15
to jenkin...@googlegroups.com

Is error.txt what you are trying to attach? If so, it needs to be in the workspace of the job that is running.


Rakesh Manoharan

unread,
Jan 13, 2015, 12:45:25 AM1/13/15
to jenkin...@googlegroups.com
Correct I am trying to send error.txt, But which is the workspace location, many people said its /var/lib/jenkins/jobs, so am putting there, is it a different one?

Slide

unread,
Jan 13, 2015, 7:09:53 AM1/13/15
to jenkin...@googlegroups.com
It depends on how your job is setup, but the workspace is specific to a single job normally, so it wouldn't be directly under the jobs directory. If you change your build step to mv error.txt ${WORKSPACE} that might get the file there.

Rakesh Manoharan

unread,
Jan 13, 2015, 11:59:44 PM1/13/15
to jenkin...@googlegroups.com
Thank you so much, that worked!!
Reply all
Reply to author
Forward
0 new messages