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

Is there a way to lock down MASTER branch priodically?

Daniel Rhodes December 15, 2017

Hello people,

Is there a cool or easy way, in Bitbucket, to lock down MASTER branch periodically (say, every Friday)?

This will be an (admittedly brute-force) approach to prevent deploys on Friday which my organisation doesn't want to do.

Or, do I need to get more into the full-fat CI tools to achieve this kind of thing?

Many thanks,

Daniel

#blueSkyThinking

2 answers

2 accepted

0 votes
Answer accepted
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2017

If you're using Bitbucket Cloud, you can use https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/branch-restrictions#post to set up or remove branch restrictions using the API. You may also be interested in the GUI version, https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html

Daniel Rhodes December 19, 2017

Great, many thanks. So, in conclusion it's "they have an API which you can use"! That's definitely schedulable and exploitable.

0 votes
Answer accepted
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2017

Are you on Bitbucket Cloud or Bitbucket Server?

If you're on Bitbucket Server, take a look at this answer, which shows how to PUT/DELETE json against the branch-permissions API end-point.

You could use cron to apply/remove a "master-is-read-only" branch-permission periodically.

Daniel Rhodes December 19, 2017

Great, many thanks. So, in conclusion it's "they have an API which you can use"! That's definitely schedulable and exploitable.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events