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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Deploying build artifacts to a different private repo

I am currently in the midst of breaking up a monolithic repo from Github to smaller modules in Bitbucket. The difficulty I am currently facing is having the CI pull the build artifacts of necessary modules from different repos. I was thinking of perhaps a repo just for holding the build artifacts of all other repos, that would create a centralized source to both download and upload all build artifacts. Is there a way this could be achieved? From what I read, there are only tutorials to uploading build artifacts to it's own repo. 

1 answer

0 votes
Ronald C_ Atlassian Team Apr 23, 2020

Hi @Ryan ,

This can be done by uploading the artifact to Bitbucket's Repository "Download" page, and the other repos/builds can download it directly with curl/wget

You may checkout the following to upload the artifact to Repository's Download page:
Deploy build artifacts to Bitbucket Downloads - Atlassian Documentation

When download the artifact, you can use the following commands to download it:

curl "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads/<YOUR_FILE_NAME>" --output "<YOUR_FILE_NAME>"

ℹ The value of the variable ${BB_AUTH_STRING} is your username and password (<username>:<password>)

Hope this helps.

 

Regards,
Ronald

Hey Ronald, 

I've been testing my workflow the past week and I manage to make it work for a saved secured variable, which is tied to a person in the team. 

 

The workflow I'm trying to implement is that on a successful merge with master, the Bitbucket Pipelines get triggered, build, and publishes the build artifact to another repo's Bitbucket Download. Now, I would very much like to have the person who triggered the merge to be identified as the person who uploaded the build artifact to the repo.

Would that be possible to accomplish?

I'm not sure if what I said was confusing, happy to clarify further.

Ronald C_ Atlassian Team May 05, 2020

Hi @Ryan

Based on my understanding you would like a build to be triggered whenever a PR is merge.

I'm afraid that Bitbucket Pipelines yet to have the feature available but we would suggest upvote the following feature request:
https://jira.atlassian.com/browse/BCLOUD-13867

A workaround that I can suggest is by create a bash script to do a merge check.
Sample bash script: https://bitbucket.org/r-comm/check-merge-commit/src/master/check-merge.sh

Build example:

You just need to replace the "echo" in line 7 command with the commands that you want to run to upload the artifact. :)

Hope this helps.

Cheers,
Ronald C. 

Hey Ronald, 

 

In the interim, would it be possible to use the credentials of the person who pushed(dosent have to be a merge) to upload the artifact?

FYI, I cant open any of the links you provided.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,804 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you