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

How can we add dynamic file name in ATTACHMENT variable in bitbucket/email-notify.

Nishita Agarwal December 7, 2022

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.
December 8, 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

Nishita Agarwal December 14, 2022

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.
December 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