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

Can I set branch restrictions to a more specific pattern than a general pattern already configured?

Mark Dorros January 4, 2023

I have branch restrictions configured for all our release branches (branch name starts with "release-", of which there are many - too many and too dynamic to list all). Is is possible to add restrictions for a single release branch, say release-23.1, without impacting the restrictions for the other release branches?

Details: I have branch restrictions for "release-*" that forces team members to merge through PRs. But if I create an additional branch restriction for "release-23.1" to only allow merges by Admins, the restrictions from "release-*" essentially override the more restrictive settings and allow merging from anyone on the team.

Use case: We have long running release branches, and need to prevent commits on a single branch after code freeze, before we go GA, and still allow normal activity on the other release branches.

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 6, 2023

Hi Mark,

In case branch permissions overlap, the results are specified in the table here:

If "Merge access via pull requests" is set up as follows:

release-*
Merge access via pull requests: Developers, Administrators

release-23.1
Merge access via pull requests: Administrators

Then both Administrators and Developers will be able to merge to release-23.1

You could change the "Merge access via pull requests" for release-* to Everybody. Everybody in this case means everybody with write access to the repo. In this case, only Administrators will be able to merge to release-23.1

If you don't want to change "Merge access via pull requests" for release-* to Everybody, then the only other way I can think of for achieving what you want would be by renaming the branch release-23.1 so that it doesn't overlap with the pattern release-* and create a separate branch restriction for that branch.

Kind regards,
Theodora

Mark Dorros January 6, 2023

Thanks, Theodora. If we implemented the first suggestion, then developers (e.g. non-Admins) wouldn't be able to merge to any release branches - something we wouldn't want to prevent, since we're only looking to prevent this for one release branch, release-23.1.

Implementing the second suggestion would likely break automation we have for managing different releases - e.g. switching branches, build artifacts, CI, etc.

By any chance, is allowing multiple branch patterns including a negative pattern on the roadmap? For example, being able to set the pattern for one branch restriction to "release-*, !release-23.1"?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 9, 2023

Hi Mark,

With the first suggestion, all users (with write access) would be able to merge to any release branches, except for release-23.1. Only administrators would be able to merge to release-23.1.

I am talking about a configuration like the following:

Screenshot 2023-01-09 at 13.13.37.png

Screenshot 2023-01-09 at 13.14.10.png


Is this something that works for you?

By any chance, is allowing multiple branch patterns including a negative pattern on the roadmap? For example, being able to set the pattern for one branch restriction to "release-*, !release-23.1"?

This is not on the roadmap at the moment, we have a feature request for allowing multiple branches in the same branch permission: https://jira.atlassian.com/browse/BCLOUD-22059 I can create one for negating a pattern as well if you'd be interested in that, please feel free to let me know if you would like me to create it.

Kind regards,
Theodora

Mark Dorros January 9, 2023

Hi Theodora,

I appreciate the detailed examples. We'll give this a try, although it might not be until our next major release in April, if we're unable to try it out now.

No need to enter a request for a negative pattern at this time.

Thanks,

Mark

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2023

Hi Mark,

You are very welcome. If you need anything further, please feel free to reach out.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events