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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,349
Community Members
 
Community Events
176
Community Groups

How to use build artifact from one pipeline into another

The problem I want to solve is as follows

  • We have a frontend repo and a backend repo
  • The backend repo has the frontend build copied to a folder
  • The backend repo gets deployed to aws
  • Pipelines are set up for 
    • Building the frontend repo
    • Building and deploying the backend repo

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. 

https://community.atlassian.com/t5/Bitbucket-questions/Access-multiple-Bitbucket-repositories-from-a-single-Pipeline/qaq-p/1783419 

Can someone help me with some pointers to copy the frontend build into backend repo? 

1 answer

1 accepted

0 votes
Answer accepted
Mark C Atlassian Team May 12, 2022

Hi @Sameeksha Chepe

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. 

Like Mark C likes this
Mark C Atlassian Team May 15, 2022

Hi @Sameeksha Chepe


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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events