Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 42

Want to try it out first? Access the interactive playground where you can check your Code Owner rules.

1.  Put a CODEOWNERS file into your repository and Code Owners will add reviewers automatically to your pull requests:

# Put this in a file called CODEOWNERS in the root directory of your repository.
# Lines starting with # are comments.

# Every rule line is a file pattern that is followed by one or more Code Owners.
# As identifiers for the Code Owners you can use the display name or nickname of 
# Bitbucket Cloud users (see screenshot below how you can find those).
**/*.java     @"James Gosling"
**/*.scala    @"Martin Odersky"
jvm/**/*.java @"Brian Goetz"

# Ordering is important! The last matching file pattern has the highest precedence.
# So if only files in the jvm sub-directories are in the pull request, Brian Goetz
# will be the code owner and not James Gosling.

# You can build your own Code Owners group. 
@@@FrontendTeam @"Brendan Eich" @"Tim Berners-Lee"

# And reference it in your Code Owner rules.
web/*        @@FrontendTeam @CTO

For more details about how owner rules work, see our Owner rules - Data Center 🗄 & Cloud ☁️ documentation.

Double quotes are only necessary if the nickname or display name contain white spaces.

@"Paul the JSGuru" @@"Dev Ops Team"

As identifiers in CODEOWNERS file are supported in Bitbucket Cloud ☁️:

  • Display Name

  • Nickname (Public name) of Bitbucket Cloud users

To get the Display Name or Nickname of a user, mention a user in the pull request (e.g. description or comments).
In the auto-complete list, you will see the Display Name on top and below the Nickname (see image below).

NOT supported:

  • e-mail addresses or user slugs

2. OPTIONAL: Configure Merge Checks to enforce approvals of Code Owners.

3. Create a pull request and the app adds all matching code owners from CODEOWNERS in the destination branch as pull request reviewers:

4. If you change your pull request, the app will add additional pull request reviewers if needed according to updated PR content.

Recommendation:
Use separate user account for installing the app, so that the calls to Bitbucket API are isolated for Code Owners app and independent to other installed apps.

  • If using same user account to install multiple apps, you risk to hit API rate limit, as the calls the installed apps make count towards the same, shared limit.

  • This user must be able to:

Protect your CODEOWNERS file

Ensure to have a Code Owners rule covering the CODEOWNERS file itself, to prevent unwanted changes regarding enforced approvals:
CODEOWNERS @CTO

Missing features in Cloud edition of Code Owners
The following features of the Data Center / Server edition are missing in Cloud edition:

  • Identifiers:

    • email as user identifier (probably not possible GDPR)

    • Bitbucket groups

  • Subdir overrides

  • Branch filtering

  • CO file naming: .bitbucket/CODEOWNERS

  • No labels