how to exclude bamboo from branch permission rule

Hi all,

I have configured branch permission for my repo, which will  prevent pushes to master branch, meanwhile I added some service users like the Bitbucket user it uses to merge changes into master...

The issue is:

when bamboo completed tests on master branch which has merged in some auto upgrades in bamboo server, it will try to push the updated master branch back to repo's master branch, but it is blocked by branch permission.

My question is:

What is the user name the bamboo is using to push back to master branch, as long as I get the name, I can add it to exclusion list, but I can't find it. Anyone can show me how to get this Please?

3 answers

1 accepted

2 votes

In Bitbucket Server, it is possible to configure Bamboo as an exception to the branch permission rules.

This can be done using the Access Key that Bamboo adds to Bitbucket Server when a repository or a branch is added to a plan.

For example, if you want want Bamboo to be able to write to the master branch directly while all other users can only do that via a pull request, you can define the Branch Permissions in this way in Bitbucket Server:

SSP27050_branchPermissions.png

 

The value in the "except by" field corresponds to the Access Key that you can find in the repository settings in Bitbucket Server:

SSP27050_accessKeys.png

This feature is available since Bitbucket Server 4.14.0 as announced in the Add access keys to branch permissions blog post.

 

Caterina - Atlassian Support

0 vote

Hello Ian,

Please, go to Bamboo and in your plan branch uncheck push from merging option.

Kind regards,
Rafael P. Sperafico

Hi Rafael,

But we need bamboo to push the branch back to repo after a successful run, it is our auto_upgrade process which will pull merge the upgrade parts into master in bamboo and push the new master branch back to repo.

Hi guys, could anyone give me a response?

You cannot whitelist this event, the checkbox mentioned in the merge option is what allows Bamboo to communicate with Bitbucket server and for the push to be made. Alternatively, you can run a Script task to do the merge, providing the user who is going to to the merge.

Is there anyway to define a Bitbucket user specifically for Bamboo to use to push? So that I can add the user name into exclusion list...

Without unchecking the [ ] push checkbox in Bamboo, no. As already mentioned, this event is internal to both application and by checking the push checkbox you are allowing Bamboo to push against Bitbucket and this is the only moment Bamboo will push against your repositories as a security measure.

So if you want to prevent push from happening, uncheck the [ ] push checkbox and create a script task to communicate with your repository and do the merge.

Please, refer to the following for further information:

 

the weird thing is that:

in the past the bamboo pusher in Bitbucket will be shown as "access key user ..."

but after a reinstallation, the pusher name changed to "Bitbucket student account", which is just one of our normal user account.

We do not know how it was changed to this account, by the way, the bamboo branch updater is also using this account to update our review branches.

 

SO, I really need to know how and where the user bamboo is using to push is configured, there must be somewhere right?

Under this location you can find the committer Bamboo will use for the merging branch.

image2016-11-28 0:25:59.png

Ram I'm New Here Apr 10, 2018

Hi Rafael,
    I am using Atlassian Bamboo version 5.13.0.1 build 51314 and Atlassian Bitbucket v4.9.1. Unfortunately, exempting "Access Keys" in Branch Permissions doesn't work in the Bitbucket v4.9.1.  And the moment I restrict permissions to my branch for users, Bamboo cant merge to the branch - reports that the branch is read-only. Please let me know if there is way to fix this. 
Also , it would be great if you can re-attach the image as it seems missing now.

Thanks.
RamN
    

Hi @Ram,

Have you seen my reply above (it is the top one in this thread), there is also a screenshot there.

 

Note: this feature is available since Bitbucket Server 4.14.0.

 

Cheers,

Caterina - Atlassian

Ram I'm New Here Apr 11, 2018

Thanks Caterina Curti

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

27,060 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you