Hi, I have next deploying plan:
I'm read Bitbucket's manual, create app password, give permission for it to write repository. I create environment variable BB_AUTH_STRING and assign my_username:app_password as value.
But when I trying upload artifact, I receive 401 status from api.bitbucket.org.
I try upload file from my local machine with same parameters:
export BB_AUTH_STRING=userName:app_password
export BITBUCKET_REPO_OWNER=team_name
export BITBUCKET_REPO_SLUG=repository_name
echo $(date) > foo.txt
curl -i -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@foo.tx
Curl returns 201 status and file has been uploaded.
When I run same commands in pipeline, curl return follow output:
+ echo $(date) > foo.txt
+ curl -i -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@foo.txt
% 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 215 0 0 100 215 0 335 --:--:-- --:--:-- --:--:-- 335
100 215 0 0 100 215 0 335 --:--:-- --:--:-- --:--:-- 335
HTTP/2 401
server: nginx
www-authenticate: Basic realm="Bitbucket.org HTTP"
content-type: text/html; charset=utf-8
strict-transport-security: max-age=31536000; includeSubDomains; preload
date: Tue, 19 Jun 2018 19:56:51 GMT
x-served-by: app-188
x-static-version: acb0ee83c5f1
etag: "d41d8cd98f00b204e9800998ecf8427e"
x-render-time: 0.58420586586
x-version: acb0ee83c5f1
x-request-count: 241
x-frame-options: SAMEORIGIN
content-length: 0
Look like when app password creates, in dialogue New app password, in end of field with password, string end with space. I copy-past this value to BB_AUTH_STRING, and meet problem with authentication in pipeline, but on local machine I'm decide to remove this space, and forget this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.