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

Bitbucket Pipeline Mail can not attach more than one file

pascal_schroeer February 25, 2024

I just wanted to extend my Bitbucket pipeline to send more than one attachment via Mail. For this I use the following .yml file:

image: dme26/latex-builder:latest

pipelines:

default:

- step:

name: Build the .pdf

script:

- cd LaTeX

- pdflatex Installation-Plan.tex

- pdflatex Installation-Plan.tex

artifacts:

- LaTeX/Installation-Plan.pdf

- Data/data.csv

- step:

name: Upload to Bitbucket Downloads

script:

- pipe: atlassian/bitbucket-upload-file:0.7.1

variables:

BITBUCKET_USERNAME: '$BITBUCKET_USERNAME'

BITBUCKET_APP_PASSWORD: '$BITBUCKET_APP_PASSWORD'

FILENAME: 'LaTeX/Installation-Plan.pdf'

- pipe: atlassian/bitbucket-upload-file:0.7.1

variables:

BITBUCKET_USERNAME: '$BITBUCKET_USERNAME'

BITBUCKET_APP_PASSWORD: '$BITBUCKET_APP_PASSWORD'

FILENAME: 'Data/data.csv'

- step:

name: Send email

script:

- MY_DATE=${MY_DATE:-$(date +%Y-%m-%d)}

- pipe: atlassian/email-notify:0.13.1

variables:

USERNAME: '$GMAIL_MAIL'

PASSWORD: '$GMAIL_APP_PASSWORD'

FROM: smtp.my@gmail.com

TO: 'myMail@icloud.com, mySecondMail@web.de'

HOST: 'smtp.gmail.com'

PORT: 587

SUBJECT: '$MY_DATE Installation-Plan'

ATTACHMENTS: 'LaTeX/Installation-Plan.pdf,Data/data.csv'
Everything works fine and also the pipeline tells me that everything is fine. But the mail I receive only includes one of the shown attachment! In this case I just receive the "data.csv" file. When I just remove ",Data/data.csv" I receive a mail with the Installation-Plan.pdf.
I followed exactly the docs...
script:
  - pipe: atlassian/email-notify:0.13.1
    variables:
      USERNAME: 'myemail@example.com'
      PASSWORD: $PASSWORD
      FROM: 'myemail@example.com'
      TO: 'example@example.com'
      HOST: 'smtp.gmail.com'
      ATTACHMENTS: 'file1.txt,file2.txt'
What's wrong here?

1 answer

1 accepted

1 vote
Answer accepted
pascal_schroeer February 27, 2024

In my in inbox I see this:

IMG_3318.jpeg

So two attachments are mentioned, but only the file „data.csv“ is attached.

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2024

@pascal_schroeer hi. I used this pipe by myself and see the two files.Screenshot 2024-03-01 at 17.41.41.png
Regards, Igor

pascal_schroeer March 2, 2024

Hmm for me it is not working. I tried also different mail addresses, but still the same issue...

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2024

@pascal_schroeer . Maybe you have problems with the second file. Try to attach only problem file to exclude this reason.

Regards, Igor 

pascal_schroeer March 3, 2024

@Igor Stoyanov Alteady done… I switched the two files in the attachment statement. This results in sending me the other file… this is why I thought it must be a syntax error…

Can you maybe give me a minimal working example for zip’ping these files before sending? At least then it should be fixed. 

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2024

@pascal_schroeer i do not know what is inside you image exactly, so some general idea:
Inside this step

 - step:

name: Build the .pdf

script:
 <install zip if not present i.e apt-get install zip.
Depends on your image>

- cd LaTeX

- pdflatex Installation-Plan.tex

- pdflatex Installation-Plan.tex
< seems like here you created a files.
So zip them: zip <options> <zip file> <source file>>
artifacts:
- <your zip files>

And then use zipped files with the pipes below.
More details how to zip.

Regards, Igor
 

pascal_schroeer March 4, 2024

Okay this works now... :)

 

BR

Like Igor Stoyanov likes this

Suggest an answer

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

Atlassian Community Events