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

Help for deploy build artifacts to Bitbucket Downloads

Guillaume Gallois May 18, 2017

I want to deploy a builded jar form simple pipeline to dowload page.

I already saw this post : https://bitbucket.org/site/master/issues/13919/deploy-build-artifacts-to-bitbucket but can't find the solution ...

  • I've created an App passwords in my account
  • Add an Environment variables BB_AUTH_STRING in the team level with the user cgismartcasetest (not from repository or account level)
  • Update the pipele with the curl command

The repository is from the team name 'cgi-smartcase-test' (id 'cgismartcasetest') and is the owner of the repository

Here some log :

echo "${BITBUCKET_REPO_OWNER}"
+ echo "${BITBUCKET_REPO_OWNER}"
cgismartcasetest
echo "${BITBUCKET_REPO_SLUG}"
+ echo "${BITBUCKET_REPO_SLUG}"
springboot-restservices-sandbox

Here the log for the curl command :

+ curl -v -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/springboot-restservices-sandbox-0.1.0.jar"
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 104.192.143.4...
* Connected to api.bitbucket.org (104.192.143.4) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
* 	 subject: C=US; ST=CA; L=San Francisco; O=Atlassian, Inc.; OU=Bitbucket; CN=*.bitbucket.org
* 	 start date: 2017-04-04 00:00:00 GMT
* 	 expire date: 2020-06-11 12:00:00 GMT
* 	 subjectAltName: api.bitbucket.org matched
* 	 issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* 	 SSL certificate verify ok.
* Server auth using Basic with user 'cgismartcasetest'
> POST /2.0/repositories/cgismartcasetest/springboot-restservices-sandbox/downloads HTTP/1.1
> Authorization: Basic Y2dpc21hcnRjYXNldGVzdDo1YUw5YVVNeUVVRkJHNXU1anZtZg==
> User-Agent: curl/7.38.0
> Host: api.bitbucket.org
> Accept: */*
> Content-Length: 31315798
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------f9b74c02efad42a6
> 
< HTTP/1.1 100 Continue
} [data not shown]
< HTTP/1.1 401 Unauthorized
* Server nginx is not blacklisted
< Server: nginx
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Bitbucket.org HTTP"
< Content-Type: text/html; charset=utf-8
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< Date: Thu, 18 May 2017 08:55:36 GMT
< X-Served-By: app-161
< X-Static-Version: 51240b5303d2
< ETag: "d41d8cd98f00b204e9800998ecf8427e"
< X-Render-Time: 0.0207269191742
< Connection: keep-alive
< X-Version: 51240b5303d2
< X-Request-Count: 54
< X-Frame-Options: SAMEORIGIN
< Content-Length: 0
* HTTP error before end of send, stop sending
< 

100 29.8M    0     0  100 29.8M      0  54.7M --:--:-- --:--:-- --:--:-- 54.8M
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]

Capture.PNG

 

Thanks you

 

Guillaume GALLOIS

 

1 answer

0 votes
davina
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2017

Hi Guillame,

In your curl command, can you try prepend your username (not team) to the user? Like this:

--user "<your_bitbucket_username>${BB_AUTH_STRING}"
Guillaume Gallois May 22, 2017

Hi,

Do you mean change the content of the BB_AUTH_STRING variable ?

I've made the test with :

  • curl -v -X POST --user "myuserid${BB_AUTH_STRING}" ...
  • replace the teamid by my userid in the environment variable BB_AUTH_STRING like this : myuserid:XXXXX

Still get the same error :-(

 

 

Guillaume Gallois May 22, 2017

Juste made a test with the environement variable "BB_AUTH_STRING" at the repository level : same issue.

davina
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2017

Whoops, I forgot the colon! 

So the whole curl command should look something like this:

curl -v -X POST --user "<your_bb_username>:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/springboot-restservices-sandbox-0.1.0.jar"

 

Guillaume Gallois May 23, 2017

So,


It work with :

echo "${BITBUCKET_REPO_OWNER}"
cgismartcasetest

echo "${BITBUCKET_REPO_SLUG}"
springboot-restservices-sandbox

curl -i -X POST --user "galloisg:${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"target/springboot-restservices-sandbox-0.1.0.jar" --verbose

 

But still KO with :

echo "${BITBUCKET_REPO_OWNER}"
cgismartcasetest

echo "${BITBUCKET_REPO_SLUG}"
springboot-restservices-sandbox

curl -i -X POST --user "cgismartcasetest:5aL9aUMyEUFBG5u5jvmf" "https://api.bitbucket.org/2.0/repositories/cgismartcasetest/springboot-restservices-sandbox/downloads" --form files=@"target/springboot-restservices-sandbox-0.1.0.jar" --verbose

Even if cgismartcasetest is the owner of the repository, i need to add tu user id instead of.

Thanks you

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events