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

How can I publish an artifact

Serhii-S.Divnych April 5, 2022

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

  

Serhii-S.Divnych April 8, 2022

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

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 

0 votes
o_kyrdan April 13, 2022

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

Atlassian Community Events