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

Deploy build artifacts to Bitbucket Downloads - not working

Guy_Incognito March 20, 2018

Hi!

I followed the tutorial at:

https://confluence.atlassian.com/bitbucket/deploy-build-artifacts-to-bitbucket-downloads-872124574.html

However the file upload via curl is not working in my case, altough curl states so otherwise:

curl -X POST "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"file.pdf"  

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1680k    0     0  100 1680k      0  6426k --:--:-- --:--:-- --:--:-- 6413k
100 1680k    0     0  100 1680k      0  4926k --:--:-- --:--:-- --:--:-- 4927k

Afterwards the downloads section is still empty...

Has anybody an idea what might be the case here?

 

1 answer

1 accepted

1 vote
Answer accepted
Jeroen De Raedt
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2018

Hey @Guy_Incognito,

I suspect that your repository is not public and thus you need to pass in credentials with your request. 

To test this, add '-v' at the end of your curl command, which enables verbose logging: 

curl -X POST "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"file.pdf" -v 

If this responds with a 401 HTTP response code, create an Application Password, which you configure as a secured variable in Pipelines. Then add `-u <your-user>:<your-password>`. 

Guy_Incognito March 28, 2018

Thanks @Jeroen De Raedt

Altough the ${BB_AUTH_STRING} did containt the "username:password" combination, the problem was indeed a 401 issue.

I switched to using the ' -u "${USERNAME}:${PASSWORD}" '  option and everything works like a charm..

Thanks a lot!

Like James_gustard likes this
oladipo-olasemo December 12, 2019

worked for me too... thanks!

pascal_schroeer December 21, 2019

Could anyone please post a complete curl command? Where to add 

-u "${USERNAME}:${PASSWORD}"

 

Guy_Incognito December 21, 2019

I used the following command:

curl -X POST --user "YOUR_USERNAME:YOUR_PWD" "https://api.bitbucket.org/2.0/repositories/YOUR_USERNAME/YOUR_REPO/downloads" --form files=@"YOUR.FILE" -v
pascal_schroeer December 21, 2019
 -curl -X POST --user "USERNAME:PWRD" "https://api.bitbucket.org/2.0/repositories/TEST/Application/downloads" --form files=@"bewerbung.pdf" -v

Like this?

Guy_Incognito December 21, 2019

@pascal_schroeerYes, like this!

pascal_schroeer December 21, 2019

But I get the following warning:

Bildschirmfoto 2019-12-21 um 11.02.01.png

pascal_schroeer December 21, 2019
https://${BB_AUTHENTIFICATION}@api.bitbucket.org/2.0/repositories/pascal_schroeer/application/downloads

Where ${BB_AUTHENTIFICATION} is "myUsername:myPwrd" 

I tried to copy paste this link to the browser and I get

Access denied. You must have write or admin access.

So it seems that the rights of my App Password are not enough... But I already checked everywhere write permissions...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events