The problem I want to solve is as follows
The only missing piece is automating the frontend build copy to the backend repo. The following post solves this problem partially - it shows how to trigger the frontend pipeline from the backend pipeline. But it doesn't tell me how to use the artifacts from the triggered pipeline.
Can someone help me with some pointers to copy the frontend build into backend repo?
Thank you for reaching out to the community.
Unfortunately, it is not possible to pass build artifacts from one Pipeline to another as it is only intended to work for steps.
As a workaround, you can use the Downloads section of your repository to upload and get build artifacts.
You can check this documentation for more information: Deploy build artifacts to Bitbucket Downloads
The idea is to upload the artifact to the Downloads section first and retrieve/download it using cURL command.
To upload, you can use the Pipes script atlassian/bitbucket-upload-file as below:
script: - pipe: atlassian/bitbucket-upload-file:0.3.2 variables: BITBUCKET_USERNAME: $BITBUCKET_USERNAME BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD FILENAME: 'build.zip' ACCOUNT: 'myworkspace' REPOSITORY: 'backend-repo'
To download the file:
curl -sL -u bb_username:app_password "https://api.bitbucket.org/2.0/repositories/workspace_id/repo_name/downloads/build.zip" --output "build.zip"
Hope it helps and let me know if you have further questions that I can help with.
Regards,
Mark C
Thank you very much @Mark C for this guidance. Indeed this worked well for my use-case!
The only change I did is, I uploaded the build to the frontend-repo downloads section and used the curl command in the backend-repo build. This is because the backend repo is what gets deployed, and it includes the front-end build.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Glad to know it worked.
Yes, indeed, you can upload the artifact to either of the repositories.
Do let me know if you have further questions that I can help with and feel free to mark this question as answered as well.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.