Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

CODEOWNERS doesn't work

Reinaldo Andrés Arias Pinto April 29, 2024

I was following this tutorial https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-code-owners/
but doesn't work, any idea about this?

2 answers

2 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 30, 2024

Hello all,

If you are referencing a workspace user group in your codeowners file, make sure that the group-slug is provided in the rule as follows : 

<file pattern> @workspace-slug/group-slug

 

For example, for a user group named MyTestGroup, the codeowners rule should reference mytestgroup

 

# Choose all members of a workspace group
*.js   @workspace-slug/mytestgroup

If you use the group name instead of the slug, bitbucket will not be able to match the rule with the actual group.

This is explained more in detail in the following article, along with instructions on how to find the group slug : 

Thank you!

Patrik S

Stephen Baker May 1, 2024

Thanks for your answer @Patrik S . I read through the article carefully and have re-read the docs countless times, but it just won't work. Is the workspace-slug just the slug itself (workspace-name), or does it need to be a full URL (https://bitbucket.org/workspace-name)? I have been using just the slug, but it doesn't like it. The docs barely even mention the workspace-slug stuff, so I'd really appreciate some guidance on this, and I'm sure others would as well.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2024

Hello @Stephen Baker ,

The formatting to reference a workspace user group contains an @ symbol followed by the workspace-slug

*.py @workspace-slug/group-slug

You can find the workspace-slug by navigating to your workspace and checking the URL, which will be in the format : 

https://bitbucket.org/<workspace-slug>/<rest of the URL>

Some things I would suggest double-checking that may be causing the code owners not to work : 

  • CODEOWNERS file needs to be present in the destination branch of the pull request
  • The file should be named CODEOWNERS in uppercase letters.
  • The CODEOWNERS file needs to be placed inside a folder named .bitbucket, and this folder must be in the root directory of the repository (the absolute path to the file should be .bitbucket/CODEOWNERS)

If this still doesn't work, would you mind sharing your CODEOWNERS file here? In case you prefer not to share here as it's a public forum, please let me know, and I can raise an internal support ticket to investigate this further.

Thank you, @Stephen Baker !

Patrik S

Stephen Baker May 2, 2024

I basically posted it already in my message on April 29th. But here is the exact one-liner in my .bitbucket/CODEOWNERS file:

* @tcg-machines/javascripters:all

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2024

Thanks for confirming @Stephen Baker !

I tested using the same rule as you posted, just changing the workspace slug to reflect my own workspace, and the reviewers were successfully assigned when creating a new pull request.

In this case, as we already went through different tests that could be causing the reviewers not to be added, I will be raising a support ticket for you to investigate this further.

You should be receiving an email with the ticket link in a few minutes, but in case you don't, please let me know so I can share it with you here (only you and Atlassian will have access to the ticket).

Thank you, @Stephen Baker

Reinaldo Andrés Arias Pinto May 3, 2024

For me it doesn't work with any of these configurations.

* @username
* username
* @email
* email
* @workspace/username
* @workspace/email

 Also I tested using a teams.yaml an nothing

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2024

Hey @Reinaldo Andrés Arias Pinto ,

The syntax is different depending on which type of user you are referencing :

  • Reference a user by the email : 
    * user1@example.com user2@example.com
  • Reference the user by the username
    * @username1 
  • Reference a workspace user group
    * @workspace-slug/group-slug
  • Reference a group defined in the team.yaml file : 
    * @teams/frontend

     

Could you try using the syntax as above and also grant that the .bitbucket/CODEOWNERS file is present in the destination branch of the pull request? 

Also, I see you have access to a workspace with an active subscription that is entitled to our Premium support, so if you are still facing issues with the syntax above, let me know so I can open a support ticket for you.

Thank you, @Reinaldo Andrés Arias Pinto !

Patrik S

Reinaldo Andrés Arias Pinto May 6, 2024

that is what I said before, I've tried with all of those syntax and didn't work also using team.yaml .
what I did:

branch A with .bitbucket/CODEOWNERS and with all of these syntax.

* user@email.com
* @User@email.com
* username
* @workspace/username
* @workspace/user@email.com
PR from branch B pointing to branch A, and nothing happen
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 6, 2024

Hey @Reinaldo Andrés Arias Pinto ,

Thank you for your time in testing those possible scenarios.

I went ahead and created a support ticket for you using the email of your community account. You should be receiving an email with the ticket link soon. Let me know if you don't receive it so I can share it with you here.

Reinaldo Andrés Arias Pinto May 9, 2024

I have not received

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2024

Hey @Reinaldo Andrés Arias Pinto ,

You can access the ticket directly in the support portal, while logged in, through the following link : 

 

1 vote
Stephen Baker April 29, 2024

Same issue here. I received an email with a link to this and quickly added a .bitbucket/CODEOWNERS file to my project but when I created a pull request, the Reviewers were never populated. I made several pull requests after checking in the required CODEOWNERS file, and no dice. Hopefully someone can help us fix this.

My file only has one line in it. For the sake of this example, let's say my workspace slug is spider-man. I also have a group called javascripters with 3 members associated to it. This is my file:

*  @ spider-man/javascripters:all

In the snippet above, since the formatting in this text editor does too much magic, I had to add a space after the @ symbol that I don't actually have in my real file.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events