You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I believe https://jira.atlassian.com/browse/BCLOUD-20121 is very similar to the issue I am hitting.
I have a workspace access token, and I also am protecting the release branch.
The workspace access token can create tags, but not a release branch. How do I give that permission to the token?
The workaround in that ticket is to use OAuth... and I did not want my jenkins/TeamCity based CI CD pipeline script to have to go through that hassle. Is there another way? How do we create protected branches from non-atlassian CI/CD?
To be clear, I am trying to create a branch.
PS build> invoke-restmethod -Method 'POST' -uri "https://api.bitbucket.org/2.0/repositories/$workspace/$slug/refs/branches" -Headers $headers -Body $body
invoke-restmethod : {"type": "error", "error": {"message": "You are not allowed to create a branch that matches the pattern \"release/*\".", "code":
"BRANCH_PERMISSION_VIOLATED", "data": {"key": "BRANCH_PERMISSION_VIOLATED"}}, "data": {"key": "BRANCH_PERMISSION_VIOLATED"}}
At line:1 char:1
+ invoke-restmethod -Method 'POST' -uri "https://api.bitbucket.org/2.0/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
PS build>
PS build> $headers
Name Value
---- -----
Authorization Bearer XXXXXX..
Content-Type application/json
Accept application/json
PS build> $body
{
"name": "release/XXXX",
"target": {
"hash": "HEAD"
}
}
PS build>
Hello @Sumanta Chakraborty ,
Thank you for reaching out to Atlassian Community!
I've noticed that you have also opened an internal ticket with us, as you have an active Bitbucket subscription, and one of our support engineers is already working with you on that ticket.
I would just like to share here as well, in case others are interested in the same feature, that currently Workspace/Project/Repository Access tokens (WATs, PATs and RATs) are not available to be added in the branch permissions. We have a feature request open to implement this functionality, which can be accessed using the following link :
I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.
The current workaround is using basic auth with an App Password to authenticate the request.
Thank you, @Sumanta Chakraborty !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Basic auth of user kind of works - but I get Rate limited continuously.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.