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,559,480
Community Members
 
Community Events
184
Community Groups

how to save artifacts after builds in bitbucket ?

I need help saving the artifacts using the bitbucket repository and saving it downloads. 

How to write the code for it?

2 answers

2 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 25, 2022

Hello @Neehar Pavan Chaluvadi ,

Welcome to Atlassian Community.

In order to generate artifacts in your pipeline build, you will need to add an artifacts section to your build step to define the name/patterns of files you want to be included, as in the example below : 

pipelines:
  default:
    - step:
        name: Build and test
        script:
          - npm install
          - npm test
          - npm run build
        artifacts: # defining the artifacts to be passed to each future step.
          - dist/**
          - reports/*.txt

The artifacts will be available for future steps in the same build. Artifacts are stored for 14 days following the execution of the step that produced them, and during this period you can manually download them by going to your build step and :

  1. Select the Artifact tab of the pipeline result view

  2. Click the download icon

After 14 days, the artifacts are expired. For more details please refer to Use artifacts in steps

In case you also want to upload the files generated in your build to the Downloads section of your repository, you can make use of the Bitbucket API. You would have to execute the API call as part of your build script, as in the following example : 

curl -s -u USERNAME:APP_PASSWORD -X POST https://api.bitbucket.org/2.0/repositories/<WORKSPACE>/<REPOSITORY>/downloads -F files=@hello.txt

This would upload a file named hello.txt to your repository's Downloads section. For more examples of this specific API endpoint, you're also welcome to check  Upload a download artifact.

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

Thank you, @Neehar Pavan Chaluvadi !

Kind regards,

Patrik S

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 25, 2022

Hey @Neehar Pavan Chaluvadi ,

We also have this step-by-step tutorial on how to deploy to Bitbucket Downloads using your pipeline build : 

Kind regards,

Patrik S

0 votes
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 20, 2022

Hi @Neehar Pavan Chaluvadi 

Welcome to the Community!!

For an example, refer here --> https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps

Thanks,
Pramodh

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events