Code Owners for Bitbucket Cloud
Code Owners for Bitbucket Cloud
Get started
For installation check corresponding section.
- Define a
CODEOWNERS
file in the root of your repository with code owners rules - Create a pull request (with
CODEOWNERS
file in destination branch) - Benefit from auto-assigned reviewers
- Add merge checks to enforce code owner reviews
Discover more features in our Code Owners documentation.
Owner rules
The syntax for owner rules is simple
<filepattern> <members>
<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**/*.java
all java filesci/*
all files in directory ci without sub directoriesfrontend/
all files in directory frontend with sub directories!ci/playgrounds.yml
exclude code owners for selected files- files starting with
#
or!
can still be used by escaping them\!file.txt
Ordering is important! The last matching file pattern has the highest precedence. Generic rulse should be put first, followed by more specific rules.
Custom Groups
The syntax to create custom groups is
@@@<newgroupname> <members>
- The group can be used in owner rules in group syntax
@@<newgroupname>
(only two@
symbols)
Merge checks
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
Rules:
- Only groups can be used in merge checks, no individual users
- Combine merge checks on a single line with
|
(OR) and&
(AND) - 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.
Special Checks:
Minimum number of approvals needed from all matching code owners.
OverallCheck(n)
Minimum number of approvals needed from each matching code owners group.
AllGroupsCheck(n)
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.
Examples
**/*.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!
Upgrading
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
:https://bitbucket.org/YOUR_WORKSPACE_NAME/workspace/settings/addon-management
- Select the app you want to update.
- Press the
Update
button.
Data security and privacy - Code Owners for Bitbucket Cloud
Please find the general privacy policy here: Privacy Policy (Cloud apps)
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.
Add-on Scopes
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.
Backup
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.