I want to automatically build a LaTex document (step 1) and after that send the generated .pdf file via e-mail as attachment (step 2).
STEP 1: (WORKS)
image: dme26/latex-builder:latest
pipelines:
branches:
master:
- step:
script:
- pdflatex
-jobname=Test Test.tex; - pdflatex -jobname=Test Test; - ls - curl -X POST "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"Test"
STEP 2: (ERROR)
- step:
script:
- pipe: atlassian/email-notify:0.4.2
variables:
USERNAME: $EMAIL_ADDRESS
PASSWORD: $EMAIL_PW
FROM: $EMAIL_ADDRESS
TO: $ANOTHER_EMAIL_ADDRESS
HOST: 'smtp.googlemail.com'
#ATTACHMENTS: 'Test.pdf' #SEND generated .pdf
Hi @pascal_schroeer ,
thank you for your question!
In your case, artifacts will help you to share generated pdf-file with the next steps:
image: dme26/latex-builder:latest
pipelines:
default:
- step:
name: Build the pdf
script:
- pdflatex --shell-escape Test.tex
artifacts:
- Test.pdf
- step:
name: Upload to Bitbucket Downloads
script:
- pipe: atlassian/bitbucket-upload-file:0.3.2
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: 'Test.pdf'
- step:
name: Send email
script:
- pipe: atlassian/email-notify:0.4.2
variables:
USERNAME: $EMAIL_ADDRESS
PASSWORD: $EMAIL_PW
FROM: $EMAIL_ADDRESS
TO: $ANOTHER_EMAIL_ADDRESS
HOST: 'smtp.googlemail.com'
ATTACHMENTS: 'Test.pdf'
Also, it's a best practice to separate build and upload/send steps.
Cheers,
Oleksandr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
Thanks for your explanation! I changed my pipeline code to your suggestion.
But there are still two open points.
Best Regards!
Pascal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Oleksandr Kyrdan Can you please have a look at this question? https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-Pipeline-Mail-can-not-attach-more-than-one-file/qaq-p/2620066
I'm not able to send more than one attachment in the same mail...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.