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,457,842
Community Members
 
Community Events
176
Community Groups

How can I publish an artifact

Hi.

I try to us this dock https://support.atlassian.com/bitbucket-cloud/docs/deploy-build-artifacts-to-bitbucket-downloads/

 

I am unable to use pipe: atlassian/bitbucket-upload-file:0.3.2  (it is not working)

 

I am trying to use curl below with my variables

curl -X POST "https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"app/build/outputs/apk/debug/application.apk"

 

How it looks in BB pipelines below:


+ pwsh -noprofile -Command { curl -X POST "https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/***/***/downloads" --form files=@"***" }
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 5110 0 0 100 5110 0 8604 --:--:-- --:--:-- --:--:-- 8617

 

Please help me understand if the file was uploaded and if so where?

There is nothing in the download section

 

PS. all steps is green

3 answers

2 accepted

1 vote
Answer accepted
Ben Atlassian Team Apr 06, 2022

G'day Serhii,

Welcome to the Bitbucket Cloud Community! 

The reason the step is likely completed is that the cURL command has been sent but has not necessarily been processed correctly.

The format of the command you have provided looks slightly incorrect - can you please try the following format as below in a local terminal to see if it completes?

curl -X POST --user username:AppPassword https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads -F files=@pathtofile.extension 

Once that is done, try the command above in Bitbucket Cloud pipelines.

Depending on your OS (ie Mac/Linux/Windows) - you will need the " " characters for the path on Windows - other OS does not require these and will often result in the command failing. I would recommend not using " " in Bitbucket Cloud Pipelines in general, but try with and without.

The files should be present in the left-hand sidebar of the repository under the "Downloads" heading.

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

  

HI, @Ben Thanks for your answer

 

It does not help.

I try with quotes and without quotes and get no result (

+ pwsh -noprofile -Command { 
curl -X POST --user ${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD} https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads
-F files=@"analytics\DWH\bin\Debug\db.dacpac"
}

It might not work with pseudo paths?

But on the other hand, I cannot change the execution directory of this command, and it is always executed from the root
Best regards

Serhii

Ben Atlassian Team Apr 11, 2022

Hey Serhii,

Unfortunately, I'm not familiar with executing cURL via powershell commands. The cURL command I provided works on my end to upload files and should work as well on your end (assuming you are entering the BITBUCKET_USERNAME and BITBUCKET_APP_PASSWORD) in plaintext to pass this information through like I have done in my testing.
It would either be the path or the credentials causing the issue, I recommend looking at our documentation related to this:
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads/#api-repositories-workspace-repo-slug-downloads-post

Cheers!

- Ben (Bitbucket Cloud Support)

0 votes
Answer accepted

I already understand how to use curl request

curl -X POST --user username:AppPassword https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads -F files=@pathtofile.extension 

Where username - it is your user name (not app username)

It doesn't make sense to me, but that's how it is.

 

Thanks for help @Ben 

Hi @Serhii-S.Divnych

Could you provide us with more details why you unable to use atlassian/bitbucket-upload-file pipe?

 

Best regards,
Oleksandr Kyrdan

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events