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,463,345
Community Members
 
Community Events
176
Community Groups

How to change the build number on a bitbucket repository pipeline located in a team, not a user.

Hi I am trying to change the build number on a Bitbucket pipeline.

The Repository is located under a Team Account and not under my Username Account.

I have followed the guide

"Set a new value for the Pipelines build number":
https://confluence.atlassian.com/bitbucket/set-a-new-value-for-the-pipelines-build-number-935380150.html

But without expected outcome  :(

I have setup my user account, with an app password, and can see that I get a "404 not found" error now, instead of a "401 Unauthorized". 

As can be seen underneath in the log extract, the 404 error seems like I am pointing towards the wrong repository location. 

 

So I was thinking of using the team name and create an App Password. but that is not possible.

"Bitbucket Settings -> ACCESS MANAGEMENT -> App Passwords" is only available for User Profiles and not Teams.

Teams only have OAuth.

 

How do I change the build number for a repository located in a Team, and not on a user like the above guide expects?

 

My best try:

$ curl -v -H 'Content-Type: application/json' -XPUT \
> -d '{"next": 9000}' \
> --user 'MY_USER_ACCOUNT:APP_PASSWORD_WITH_PIPELINE_ACCESS' \
> 'https://api.bitbucket.org/2.0/repositories/MY_USER_ACCOUNT/REPOSLUG/pipelines_config/build_number'


* Trying 18.205.93.6...
* TCP_NODELAY set
* Connected to api.bitbucket.org (18.205.93.6) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Atlassian, Inc.; OU=Bitbucket; CN=*.bitbucket.org
* start date: Jun 12 00:00:00 2017 GMT
* expire date: Jun 16 12:00:00 2020 GMT
* subjectAltName: host "api.bitbucket.org" matched cert's "*.bitbucket.org"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Server auth using Basic with user 'MY_USER_ACCOUNT'
* Using Stream ID: 1 (easy handle 0x7fffe2bf08e0)
> PUT /2.0/repositories/MY_USER_ACCOUNT/REPOSLUG/pipelines_config/build_number HTTP/2
> Host: api.bitbucket.org
> Authorization: Basic YmxqX2FjdTpkRlhHZ1ozeWVFcU5EblJ2VkNNYg==
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 12
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* We are completely uploaded and fine
< HTTP/2 404
< server: nginx
< content-type: application/json; charset=utf-8
< x-oauth-scopes: pipeline:variable
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< date: Thu, 08 Aug 2019 13:28:50 GMT
< x-served-by: app-140
< x-static-version: d7eafd731394
< etag: "d8570ff7a4314593e35e9bc69e81400a"
< x-credential-type: apppassword
< x-render-time: 0.0304181575775
< x-version: d7eafd731394
< x-frame-options: SAMEORIGIN
< x-reads-before-write-from: default
< x-request-count: 749
< content-length: 52
<
* Connection #0 to host api.bitbucket.org left intact

---------

 

 

 

1 answer

1 accepted

1 vote
Answer accepted

I figured it out, with the help of a friend :)
This might help somebody else. 

 

I was using my username, twice (as the guide highlighted). But I should have done was use my username once, and the repo "username" once.

What i did:
repositories/MY_USER_ACCOUNT/REPONAME

What I should have done:
repositories/TEAM_USER_NAME/REPONAME

like this

 curl -v -H 'Content-Type: application/json' -XPUT \
> -d '{"next": 9001}' \
> --user 'MY_USER_ACCOUNT:APP_PASSWORD_WITH_PIPELINE_ACCESS' \
> 'https://api.bitbucket.org/2.0/repositories/TEAM_USER_NAME/REPOSLUG/pipelines_config/build_number'

 

Hope it helps somebody else :)

Note 1: My repository name contained one upper-case letter. In the URL, I had to write it lower-case, to make the PUT return a 200. 

Note 2: What you call "TEAM" is now called WORKSPACE.

I hope it helps.

Yeah, that's why they write repo slug: https://support.atlassian.com/bitbucket-cloud/docs/what-is-a-slug/

However, as not a native speaker, this wiki was very helpful.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events