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

how can I pass dynamically file name for Attachment under my pipe?

Edited
- pipe: atlassian/email-notify:0.8.0
variables:
SUBJECT: '${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}: Build ${BITBUCKET_BUILD_NUMBER}'
ATTACHMENTS: test-results/ *.html
Currently this is throwing me error saying *.html file not found to attach. The result file is generated as testResult_yyyy_MM_DD_HH_MM_SS.html format. where the bold letters are dynamic values.

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Mar 09, 2023

Hello @Depstan Thankachan Xavier ,

Thank you for reaching out to Atlassian Community!

The ATTACHMENTS attribute in the pipe expects a fixed file name, and it will not expand the filenames to match a pattern like *.html.

In this case, I would suggest compressing the files in a .zip - where this compressed file would have a fixed name - and then adding the zip file as the attachment.

Following is an example of using the zip command to compress all the *.html files within the test-results folder in a zip file named my_html_files.zip :

- zip my_html_files.zip test-results/*.html

If the zip command is not available  (command not found) in the docker image you are using, you will need to install it using the following command :

- apt-get update && apt-get install -y zip

Then, in the pipe's ATTACHMENTS attribute, you can specify the name of the compressed file which will be a fixed name. The complete YAML step would look like below : 

- apt-get update && apt-get install -y zip  #only necessary if the image does not have zip 
- zip my_html_files.zip test-results/*.html
pipeatlassian/email-notify:0.8.0
variables:
SUBJECT'${ALERT_TYPE}:Bitbucket Pipe Notification for ${BITBUCKET_BRANCH}Build ${BITBUCKET_BUILD_NUMBER}'
ATTACHMENTS: "my_html_files.zip"

Hope that helps! Let me know in case you have any questions.

Thank you, @Depstan Thankachan Xavier !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events