Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Add artifacts to Bamboo notifications?

Jeff Montgomery May 28, 2015

I'd like to add some log files that are currently artifacts in a build plan to either the plan or job level emails. We are behind a VPN and it would be nice to have this non-sensitive data in the notification so it is not necessary to log in to see if we need to fix something in a build. Is this possible?

  1. If so, can anyone suggest how to add artifacts as attachments – assuming it's possible? Details needed would be whether it's plan/job, which template file, where in the file to modify, etc.
  2. Regarding modifying emails in general, is there any other documentation on customizing emails, such as what the include structure is and which emails are used for what notifications?

I've seen this page: http://tinyurl.com/ntywotk and a post about trying to modify emails: http://tinyurl.com/qzy93jz but have not been able to figure out exactly what files and where to modify them and put the pieces together regarding 1) which file to modify for which emails (considering all the includes and macros as well as main template files), 2) where to modify the file and 3) what data is available in each context, which seems to be documented only in the Bamboo Java API. I can probably work through #3 if I have a better idea of #1 and #2.

Thanks,

Jeff



4 answers

1 vote
Jeff Montgomery May 28, 2015

Thanks, Timothy. We do have an existing offline (non-Bamboo) email that contains the log file attachments, because our application is a preexisting command line test app that I coded to email the developers. Now we are trying to centralize our test reporting in Bamboo, so I modified the test app to output a .trx file, then trigger Bamboo using the web API to read it and email the results.

An alternative would be to include the stack trace from the MSTest .trx file in the email. I am speaking of the trace that appears on the Bamboo website on the build results page, on the "Tests" tab, below a failed test. We are using the "Failed Jobs And First Successful" and "Failed Builds And First Successful" emails, which have the failed test list but not the stack trace.

I think I have traced it to notificationCommonsHtml.ftl/macro: @displayTest), now I need to find out whether there is actually a failed test object available for those emails with a stacktrace (trying to research this in the java docs), and then what code to put where (learn/reverse engineer the Freemarker/Java variable syntax).

 

jyotish bishwakarma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2018

Hi Jeff, Did you find a way to do that? If yes, can you please share. I have exact same requirement too and wondering how can i do it.

Thanks in advance!

Jeff Montgomery
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2018

Jyotish, I did not find an answer, but honestly I decided that it was a bit too much effort to pursue it further, and if necessary, we can connect to our company network via VPN and view the Bamboo website. I still think it would be a nice optional feature for Bamboo.

I think your best option might be to follow Timothy Chin's suggestion and set up a script to call something on the command line to send an email. Since Bamboo has the ability to execute script task, and the various resources used in the Bamboo process are available as variables (such as the working directory), you might be able to grab an artifact from the Bamboo directory and send it in an email. I've never done this, but hopefully his link will help.

jyotish bishwakarma
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2018

Thanks for reply!

1 vote
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 28, 2015

With Bamboo itself, no. But if you think out of the box, something like this can help (http://stackoverflow.com/questions/15145496/is-it-possible-to-attach-artifacts-in-an-email-notification-in-bamboo).

0 votes
VENKATA RATNAKAR BABU KOMMISETTY July 18, 2019

@Jeff Montgomery  @jyotish bishwakarma 

I was able to create a bamboo task to run a powershell script and used below command to send email. 

You have to declare variables like  $toEmail, before like

$toEmail = "abc@xyx.com"

$mycreds = credentials for account from which you are sending

Send-MailMessage -SmtpServer smtp.yourcompanydomain.com -Port 25 -To $toEmail -From $fromEmail -Subject $subject -Body $message -BodyAsHtml -Attachments report.html -Credential $mycreds

 

if you have to enable TLS

Send-MailMessage -SmtpServer smtp.yourcompanydomain.com -Port 25 -To $toEmail -From $fromEmail -Subject $subject -UseSsl -Body $message -BodyAsHtml -Attachments report.html -Credential $mycreds 
Sriharsha R
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 16, 2019

venkata ratnakar,

what is $fromEmail value ,want to send mail automatically from bamboo?

how to pass serenity html path to get attachments?

0 votes
VENKATA RATNAKAR BABU KOMMISETTY June 10, 2019

i am surprised this was not an option when we set up notifications in bamboo. Have any of you guys found a solution? 

 

We need the thing, we have a artifact which has html report, we just want that to go along with build success/failure notification email. 

 

Any help would be appreciated. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events