CODEOWNERS with teams.yml not working
Asked by Salim S:

Hi Experts, looking for your support on adding the CODEOWNERS with teams.yaml  
Here is my team.yml  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* teams.yaml \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
developers: # Name of the Team  
contributors: # Array of contributors by email address  
- abc@domain.com  
- def@domain.com  
reviews: # Configuration for selecting PR reviewers  
strategy: all # Reverse sort by # of open PR's they are reviewing (least_busy,all or random)  
#select: 2  
principals: # Name of the Team  
contributors: # Array of principal Engineers by email address  
- ghi@domain.com  
- jkl@domain.com  
reviews: # Configuration for selecting PR reviewers  
strategy: all # Select all users, no filtering/sorting applied  
associate_principals: # Name of the Team  
contributors: # Array of associate principal Engineers by email address  
- mno@domain.com  
reviews: # Configuration for selecting PR reviewers  
strategy: all # Select all users, no filtering/sorting applied  
leads: # Name of the Team # Array of leads by email address  
contributors: # Array of leads by email address  
- pqr@domain.com  
reviews: # Configuration for selecting PR reviewers  
strategy: all # Select all users, no filtering/sorting applied

<br />

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*CODEOWNERS\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
# Use @ teams to prefix your team name and reference teams.yaml  
\* @ teams/developers @ teams/principals  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
**NOTE:** In code owner file i have intentionally gave a space in between at the rate and teams due to community post does not allow.  
Not sure why its throwing error:  
Code Owners warning: teams/developers: user not found  
Code Owners warning: teams/principals: user not found  
[@Patrik S](/t5/user/viewprofilepage/user-id/4603309)


Answers:
author: Theodora Boudale
body: Hi Salim and welcome to the community!

Are you using CODEOWNERS in a Bitbucket Cloud repo or a Bitbucket Server/Data Center repo? Your tag has the question 'cloud', but your Bitbucket Cloud account doesn't have access to any repos. If you are unsure, the URL of a Bitbucket Cloud repo on your browser starts with <https://bitbucket.org/> while Bitbucket Server/Data Center repos have a different custom URL.

CODEOWNERS with a teams.yaml file is a Bitbucket Cloud feature. If you are using Bitbucket Server/Data Center, the teams.yaml won't work. The native feature for Bitbucket Data Center is documented here (you can switch the dropdown with the version at the top right corner of that page to the one you are using):

* <https://confluence.atlassian.com/bitbucketserver/code-owners-1296171116.html>

In case you are using Bitbucket Cloud:

1. Where exactly do you see the error message you posted in your question?
2. Have you used indentation in the teams.yaml file as per our documentation <https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-code-owners/> ?
3. Do the teams.yaml and the CODEOWNERS files belong to a folder named .bitbucket in the repo?
4. Does the folder with these files exist in the destination branch of the pull request?
5. Can you please confirm that the name of your file is teams.yaml instead of team.yml?

Kind regards,  
Theodora

comments: author: Salim S
body: Hi Theodora  
Thanks for your response.  
Currently, I am using Bitbucket Server/Data Center. That may be the reason my implementation not working.  

Thanks for the links shared.  

<br />

<br />


Tags: bitbucket-data-center

codeowners