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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,284
Community Members
 
Community Events
177
Community Groups

email notification with artifacts

hi,

Can anyone please tell me how to configure the email notifications for every build "Success/Failure", If build is "Success" need the "Artifacts" to be attached with email as well.

few examples are there, a step by step implementation will be more helpful.

 

Thanks.

1 answer

1 vote
Patrik S Atlassian Team May 19, 2022

Hello @PrasanthK ,

Welcome to Atlassian Community!

You could configure an after-script section in your step combined with the pipe atlassian/email-notify to send an e-mail with the status of the build and also with the artifacts attached.

The after-script section is always executed independently if the commands in the step have failed or not.

Please allow me to share a configuration example using Gmail's SMTP:

 

pipelines:

default:

- step:

script:

- echo "This is test command 1" > file1.txt

- echo "This is test command 2" > file2.txt

after-script:

- ALERT_TYPE="success"

- if [[ $BITBUCKET_EXIT_CODE -ne 0 ]]; then ALERT_TYPE="error" ; fi

- pipe: atlassian/email-notify:0.7.0

variables:

USERNAME: 'example@example.com'

PASSWORD: $PASSWORD

FROM: 'example@example.com'

TO: 'example@example.com'

HOST: 'smtp.gmail.com'

SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}'

ATTACHMENTS: 'file1.txt,file2.txt'

DEBUG: 'true' #OPTIONAL

The example above creates two text files (file1.txt and file2.txt) in the default directory as part of the step's script. The after-script section will check the value of $BITBUCKET_EXIT_CODE to define if the commands executed in the step were successful or not ( 0 exit code equals success). Then it will send an e-mail with the status of the build - 'success' or 'error' - and the created files attached, accordingly to the values configured in the variable section of atlassian/email-notify pipe.

You can adapt the above example with your current e-mail provider. For detailed instructions on how to configure the pipe, you can refer to its official documentation :

This documentation also provides links to the most common providers and how you should configure them.

Hope that helps! In case you have any further questions related to this topic, please let me know.

Thank you, @PrasanthK .

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events