tencent cloud

All product documents
Use Code Owner Mechanism
Last updated: 2023-12-25 17:08:18
Use Code Owner Mechanism
Last updated: 2023-12-25 17:08:18
This document describes how to use the code owner mechanism.

Open Project

1. Log in to the CODING Console and click the team domain name to go to CODING.
2. Click

in the upper-right corner to open the project list page and click a project icon to open the corresponding project.
3. Select Code Repositories in the menu on the left and click Branches to go to the branch management page.
The code owner mechanism must be used together with Branch Protection. Place the declaration file CODEOWNERS in a code repository to declare the owner of the code files in this repository. Generally, the code owner is the project owner.
When the target branch of a merge request is a protected branch and the files changed in the request involve the paths or files set in the declaration file, the merge request details will list the corresponding owners and their review statuses.

In the figure above, the CODEOWNER file declares that the owner of the files in the charts/repos/** path is Sally. When a merge request is submitted for a protected branch and it involves changes to files in the chars/repos/ path, Sally is automatically added as a reviewer for this request.
Note:
You can use the continuous integration plugin to automatically add reviewers. For details, see Automatically Add Merge Request Reviewers.
In the protected branch settings, toggle on Enable Review by Code Owner. Then, code owners must Allow Merge for every merge request that changes code under their jurisdictions.


Declaration file URL

By default, CODEOWNERS files are searched for layer by layer from the following locations. The file name must be in uppercase, and the search will stop when one file is found.
Root directory
docs/ directory

Declaration file format reference

The declaration file is a normal text file. Blank lines and lines starting with # are ignored. Each line uses the following format:
pattern email email email ...

pattern indicates a file path mode. email is the owner's email. You can enter multiple owners separated by spaces. Sample file:
# Declares all files with the extension .js
*.js yourname@coding.net

# Declares the files in the build/logs/ directory (including subdirectories) under the repository root directory
/build/logs/ yourname@coding.net

# Declares all files in docs/ folders (not including subdirectories)
docs/* yourname@coding.net

# Declares all files in the docs/ folder (including subdirectories) under the root directory
/docs/ yourname@coding.net

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support