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 we add dynamic file name in ATTACHMENT variable in bitbucket/email-notify.

I am sending this path to Attachments variable under email-notify:

 TO: 'myemail@example.com'
           HOST: 'smtp.gmail.com'
           SUBJECT: 'Bitbucket Pipe Notification'
+          ATTACHMENTS: 'TestResults/TestReports/*.html'

However it gives this error.

EmailError.PNG

I want to know if we can use glob pattern here or how can we select latest file from Downloads folder of bitbucket repository and send its name here.

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 08, 2022

Hi @Nishita Agarwal,

Welcome to the community.

Unfortunately, the atlassian/email-notify Pipes script does not support glob pattern.
It has to be the exact file name(s) located within your cloned repository directory in Pipelines.

You mentioned selecting the latest file from the Downloads folder of your Bitbucket repository, would you be able to confirm if you're referring to an actual "downloads" folder located inside your repository or you're referring to the repository Downloads tab?

 

Regards,
Mark C

Hi @Mark C 

Thanks for your reply.

I was referring to the repository Downloads tab.

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 14, 2022

Hi @Nishita Agarwal,

Thanks for that information.
Unfortunately, it is not possible for you to download the latest file in your repository Downloads tab.
You'll need to identify the file name you'd like to download and reference it as an attachment to the atlassian/email-notify Pipes script.

Here's a sample CURL command on how to download a specific file in a repository Downloads tab that you can add to your YAML script:

curl  -u "bb_username:app_password" --location --request GET "https://api.bitbucket.org/2.0/repositories/workspace_id/repo_name/downloads/test_file.zip" --output test_file.zip

Once done, you can use the file test_file.zip as an attachment.

Hope it helps and do let me know if you have further questions.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events