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

How do we store artifacts in a folder created on same branch

vivek.gopalakrishnan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 18, 2023

Hi Team, 

 My pipeline script is able to successfully build and an Artifact is available for download in the artifact section. however, I want to move the artifact to a folder in the same branch as a pipeline script. How do I do that?


- step:
name: Build React application
caches:
- node
script:
- npm rebuild node-sass
- npm run build-react
- npm run build-cicd
- export ARTIFACT_NAME=example-$(date +%Y-%m-%d-%H%M%S).tar.gz
- ls $ARTIFACT_NAME
- tar -xzvf $ARTIFACT_NAME -C artifacts-dev/
artifacts:
- artifacts-dev/*

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 19, 2023

Hello @vivek.gopalakrishnan and welcome to the community!

My understanding is that you would like to push the artifact back to your repository during your pipeline build. It's possible to push changes back to the repository by committing the changes and doing a git push : 

step:
  nameBuild React application
caches:
node
script:
npm rebuild node-sass
npm run build-react
npm run build-cicd
export ARTIFACT_NAME=example-$(date +%Y-%m-%d-%H%M%S).tar.gz
ls $ARTIFACT_NAME
tar -xzvf $ARTIFACT_NAME -C artifacts-dev/
- git add $ARTIFACT_NAME # adding the artifact to the staging area
- git commit -m "[skip ci] saving artifact to the repository"
- git push

The [skip ci] flag in the commit message is for this push to not trigger a new build, otherwise, the builds could enter a loop state. It's important to note that pushing artifacts directly to the repository is not a good practice, as this will start to inflate the repository size and you can reach the repository size limits of 4GB, which would put your repository in read-only mode.

If your goal is to store the artifacts for more than 14 days, you can either upload it to a third-party storage solution or upload it to the Downloads section of your repository by using the bitbucket cloud API endpoint below : 

Files uploaded as a Download artifact are available by navigating to the repository and selecting the Downloads option in the left side panel.

Hope that helps! Let me know in case you have any questions.

Thank you, @vivek.gopalakrishnan !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events