Code Owners for Bitbucket Cloud
Code Owners for Bitbucket Cloud
For installation check corresponding section.
- Define a
CODEOWNERSfile in the root of your repository with code owners rules
- Create a pull request (with
CODEOWNERSfile in destination branch)
- Benefit from auto-assigned reviewers
- Add merge checks to enforce code owner reviews
Discover more features in our Code Owners documentation.
The syntax for owner rules is simple
<members> can consist of one or more user/group identiers
@<username>for single users
@@<groupname>for custom defined groups -> see below
- names with spaces need to be in double quotes
@"<user with spaces>"
<filepattern> can be one of, or a combination of the following
*everything in the repository
**/*.javaall java files
ci/*all files in directory ci without sub directories
frontend/all files in directory frontend with sub directories
!ci/playgrounds.ymlexclude code owners for selected files
- files starting with
!can still be used by escaping them
Ordering is important! The last matching file pattern has the highest precedence. Generic rulse should be put first, followed by more specific rules.
The syntax to create custom groups is
- The group can be used in owner rules in group syntax
The syntax for merge checks is
Check(@@<group_identifier> >= <quota>)
<group_identifier>name of defined group in the CODEOWNER file.
<filepattern>positive integer or * for all group members
- Only groups can be used in merge checks, no individual users
- Combine merge checks on a single line with
- Checks on different lines, all must be fulfilled (AND)
- Checks with inactive groups are removed from the evaluation
- Pull request author does not count towards check quota except if the PR author is the only active code owner.
Minimum number of approvals needed from all matching code owners.
Minimum number of approvals needed from each matching code owners group.
Checks in Bitbucket Cloud Merge checks will show as a build on the pull request:
Use the Bitbucket branch restrictions to enforce these checks:
- Navigate to the repository’s administration section → Branch restrictions → Merge settings (tab). (https://bitbucket.org/YOURWORKSPACE/YOURREPO/admin/branch-restrictions)
- Enable the appropriate number of required successful builds. The merge checks count as one build.
- If you are using Bitbucket Premium, you can optionally enforce the merge checks.
**/*.java @"James Gosling" **/*.scala @"Martin Odersky" jvm/**/*.java @"Brian Goetz" @@@FrontendTeam @"Brendan Eich" @"Tim Berners-Lee" web/* @@FrontendTeam @CTO
@@@Backend @"Grace Hopper" @"James Gosling" @"Martin Odersky" **/main/*.java @@Backend @@@BackendTests @@Backend **/test/*.java @@BackendTests # At least two approvals for changes in Java main code. Check(@@Backend >= 2) # Only one team member must approve, if pull request changes only Java tests. Check(@@BackendTests >= 1)
@@@Seniors @"Grace Hopper" @"James Gosling" @@@Juniors @"Martin Odersky" @"Jordan Zee" @"Travis Iralu" **/*.java @@Seniors @@Juniors # At least a senior OR two juniors must approve, before pull request with changes in Java files can be merged. (Check(@@Seniors >= 1) | Check(@@Juniors >= 2))
@@@Seniors @"Grace Hopper" @"James Gosling" **/*.java @@Seniors @"Martin Odersky" @"Jordan Zee" @"Travis Iralu" # At least a senior and two code owners in total must approve. OverallCheck(2) Check(@@Seniors >= 1)
@@@Backend @"Grace Hopper" @"James Gosling" @@@Frontend @"Martin Odersky" @"Jordan Zee" @"Travis Iralu" @@@UX @"Lee Skouras" @"John Yoo" **/*.java @@Backend **/*.js @@Frontend @@UX # For every active group at least somebody must approve, and Frontend group requires two approvals, if something changed on *.js files. AllGroupsCheck(1) Check(@@Frontend >= 2)
Installation -- Bitbucket Cloud
This add-on must be installed through the Atlassian Universal Plugin Manager (UPM):
- Choose the Bitbucket workspace that you would like to install the app to
- Once in the chosen workspace, click on Settings
- Click on Marketplace under Apps and Features
- Click on All categories drop down and choose Code review
- Code Owners for Bitbucket will show up as an option
- Click Add and grant access to the app
- The app should now be listed under Installed Apps
- You're done!
Happens automatically, except if manual approval is required.
To upgrade app manually to the latest version:
- Go to your Workspace settings under
Settings -> Installed apps:
- Select the app you want to update.
- Press the
Data security and privacy - Code Owners for Bitbucket Cloud
App specific data storage
At Mibex Software, we try to only store the bare minimum of data to accomplish our task and to provide you a pleasant user experience.
account: Ability to see all the user's account information. Note that this does not include any ability to mutate any of the data.
repository: Gives the app read access to all the repositories the authorizing user has access to.
pullrequest: Gives the app read access to pull requests and collaborate on them. This scope implies repository, giving read access to the pull request's destination repository.
pullrequest:write: Implies pullrequest but adds the ability to create, merge, and decline pull requests. This scope implies repository:write, giving write access to the pull request's destination repository.
Although the data center location of our Heroku application is Europe (i.e., amazon-web-services::eu-west-1), Heroku backups of our Postgres database are stored in the U.S.