Send mail from Jenkins with attach conditioned file

326 views
Skip to first unread message

ama...@bufetedemarketing.com

unread,
Aug 30, 2017, 6:48:27 AM8/30/17
to Jenkins Users
Hi guys!

I want to send an email from Jenkins only when a condition happens, I'll tell you: I want to attach a file .csv  only when this file has been generated in the test (there will be times that the test doesn't create that file because it will happen when the test finds errors in the information. It the test doesn't fin error in information, it doesn't create the file .csv).  I don't know if  there is any way to do it?

I've been searching in configuration of Jenkins but I don't find a way to do it...

Thanks so much for your help!!!!

Slide

unread,
Aug 30, 2017, 8:53:30 AM8/30/17
to Jenkins Users

Email-ext will do this. You just supply a pattern for the files you want attached. I think it will work fine if the files are not there.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f90493ec-a514-491b-bd3b-f86408e1a12d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jackson, Randy

unread,
Aug 30, 2017, 3:17:31 PM8/30/17
to Jenkins Users

You might also want to look into the Conditional BuildStep plugin.  It has a “File Exists” conditional.


For more options, visit https://groups.google.com/d/optout.


This email is intended solely for the named addressee(s) and may be confidential or contain privileged information. Review, disclosure, copying, distribution, or use of this email by anyone other than an intended recipient is strictly prohibited. If you received this email in error, please delete it from your system and notify the sender immediately. While precautions have been taken to help ensure no computer viruses are present, there is a risk whenever transmitting emails or downloading attachments. The sender will not be liable for any loss or damage resulting from any malware in this communication or for improper or incomplete transmission of its contents or for any delay in its receipt.

Ana MB

unread,
Aug 31, 2017, 3:46:15 AM8/31/17
to Jenkins Users
I tried to do it with Email-ext plugin but it returns an error because of the un-existed file. 
How would be the pattern? 

Thanks so much!

Ana MB

unread,
Aug 31, 2017, 3:46:59 AM8/31/17
to Jenkins Users, Randy....@infarmbureau.com
Ok, I'll test it!! Thanks so much!

Ana MB

unread,
Sep 1, 2017, 4:17:39 AM9/1/17
to Jenkins Users
Hi guys!

I have a question... from Conditional BuildStep plugin I don't have "Send mail" Option, I show you;


How could I send it?

Thanks so much!!!


El miércoles, 30 de agosto de 2017, 21:17:31 (UTC+2), Jackson, Randy escribió:

Ana MB

unread,
Sep 1, 2017, 7:32:19 AM9/1/17
to Jenkins Users
Hi!

I've found this way: putting in shell console as a new action in the step and write: mpack -s "Subject here" file us...@example.com
Where "file" would be my file I want to attach to the mail.



Why is this wrong?

Thanks so much!

W

Richard Ginga

unread,
Sep 1, 2017, 8:54:56 AM9/1/17
to jenkins...@googlegroups.com
if you add the "Any Build Step" plugin, you can run build steps as post build steps and visa-versa. you need to configure it System Configuration

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/25c2f45e-801a-4e4f-9c16-dfa193571c60%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Dick Ginga
Build Engineer

Ana MB

unread,
Sep 4, 2017, 3:13:42 AM9/4/17
to Jenkins Users
Hi Richard,

I installed that plugin "any build step", but I don't know what I have to configure in Jenkins Configuration:

Is there any tutorial about this topic?

Thanks so much!!!

Message has been deleted

Ana MB

unread,
Sep 4, 2017, 4:36:49 AM9/4/17
to Jenkins Users
Hi guys!

I've tried with the following:


But I get the following Console Output from Jenkins:

[File exists] check if file exists [test_resultados_miniprueba.csv	]
Run condition [File exists] preventing perform for step [BuilderChain]
Finished: SUCCESS

And I don't get any email.

Why?

Thanks so much!

Ana MB

unread,
Sep 4, 2017, 6:13:47 AM9/4/17
to Jenkins Users
 I've just noticed that if I put only in Command Shell:

 echo "HELLO"

Neither it happens nothing... 

why doesn't it run?? 

Thanks....

Ana MB

unread,
Sep 4, 2017, 7:37:06 AM9/4/17
to Jenkins Users

I don't understand what could be happening... any ideas?

Thanks so much!

Daniel Butler

unread,
Sep 4, 2017, 7:54:05 AM9/4/17
to jenkins...@googlegroups.com

Looking at the bracket positions in your log snippet, it looks like there could be a trailing space or two after the file name in the File text box. Make sure there’s no extra spaces around the file name as that could be messing it up.

 

Regards,

Daniel.

 

From: Ana MB
Sent: 04 September 2017 12:37
To: Jenkins Users
Subject: Re: Send mail from Jenkins with attach conditioned file

 

https://lh3.googleusercontent.com/-7FHNr3AkyDA/Wa06wg6EBXI/AAAAAAAAAKs/flfvYYgdpykESQbdbQ0hqh2AZqYQb8kwQCLcBGAs/s320/Screenshot_16.jpg

I don't understand what could be happening... any ideas?

 

Thanks so much!



El lunes, 4 de septiembre de 2017, 12:13:47 (UTC+2), Ana MB escribió:

 I've just noticed that if I put only in Command Shell:

 

 echo "HELLO"

 

Neither it happens nothing... 

 

why doesn't it run?? 

 

Thanks....



El lunes, 4 de septiembre de 2017, 10:36:49 (UTC+2), Ana MB escribió:

Hi guys!

 

I've tried with the following:

 

https://lh3.googleusercontent.com/-olFwbqs2U9A/Wa0QXJFXAVI/AAAAAAAAAKc/XbfgG3te1xgl8-wMPy35gRphq1gRPNlgQCLcBGAs/s320/Screenshot_14.jpg

 

But I get the following Console Output from Jenkins:

 

[File exists] check if file exists [test_resultados_miniprueba.csv      ]
Run condition [File exists] preventing perform for step [BuilderChain]
Finished: SUCCESS
 

And I don't get any email.

 

Why?

 

Thanks so much!

 

 


El miércoles, 30 de agosto de 2017, 12:48:27 (UTC+2), Ana MB escribió:

Hi guys!

 

I want to send an email from Jenkins only when a condition happens, I'll tell you: I want to attach a file .csv  only when this file has been generated in the test (there will be times that the test doesn't create that file because it will happen when the test finds errors in the information. It the test doesn't fin error in information, it doesn't create the file .csv).  I don't know if  there is any way to do it?

 

I've been searching in configuration of Jenkins but I don't find a way to do it...

 

Thanks so much for your help!!!!

--

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Ana MB

unread,
Sep 5, 2017, 2:44:44 AM9/5/17
to Jenkins Users
Yeah, I corrected it, but that wasn't the problem... it's still not working... even a "echo" command... I don't know why....

Thanks anyway..

Richard Ginga

unread,
Sep 6, 2017, 9:16:25 AM9/6/17
to jenkins...@googlegroups.com
that is the configuration. I select Any Build Step Step for both

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9310c87e-9ca6-49e2-88c0-e96c569cacad%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages