Hello everyone.
We have a pipeline that creates multiple branches on different repositories.
It uses Rest API to create branches and authentication method is OAuth (oauth consumer is generated in workspace settings). It worked perfectly until we added branch restrictions and now the api call fails with:
{"type": "error", "error": {"message": "You are not allowed to create a branch that
matches the pattern \"release_*\".", "code": "BRANCH_PERMISSION_VIOLATED...
This is how we have branch restrictions setup:
But it fails because whichever "user" is used when making an API call is not the Administrators group. How can we make it work if there is no user that we can add?
I hope I made it clear. Any help is appreciated.
Thanks.
Hello @Matija Varjacic and thank you for reaching out to the Community!
Unfortunately, the OAuth consumer "user" is indeed not available to be selected under the branch restrictions page, so if there's a branch restriction protecting the branch you are trying to push to, you'll not be able to push to that branch using OAuth.
We do have a request with our development team to make the OAuth user "selectable" in the branch restrictions, so it would be allowed to make operations in a protected branch. This request is currently being tracked on BCLOUD-20121 . We recommend adding your vote there to express your interest and also watch that ticket to get future updates on its implementation.
As a workaround, while that feature is not available, I'd suggest creating a new bitbucket account to act like a "bot user", and then using that bot's account username and app password to authenticate the request (basic authentication).
Since that "bot" account would be a regular user, you'd be able to invite it to the workspace and select that user in the branch restrictions.
Hope that helps! Should you have any questions, feel free to ask.
Thank you, @Matija Varjacic !
Patrik S
@
Thank you @Patrik S for the quick answer and a workaround. I will add my vote and in the meantime I will try the workaround.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.