Deploying build artifacts to a different private repo

Ryan April 21, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
April 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

Ryan May 1, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 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. 

Ryan May 6, 2020

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
AUG Leaders

Atlassian Community Events