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

CODEOWNERS on project level?

Hannes Kirsman March 6, 2024

Hi!

I wanted to ask if it would be somehow add people to codewners group on project level even if the person does not have access to all of the repos under that project? It seems it's not currently possible.

I'm actually working in a company that has it's own https://bitbucket.company.tools/ Bitbucket. There's project that has lot of repos, but then I and some other devs have access to only about 10. It would be nice if there was one place to create some groups, then add them via the CODEOWNERS file. Now it seems we need to manage them repoy by repo.

3 answers

0 votes
Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2024

As my colleague Roman mentioned, we have been working on a tool that allows you to share common configurations like Code Owners across repositories.


This tool is now available and it is called DevSensei Pull Request Workflow Automation. Its configuration is YAML-based in a file called devsensei.yaml, so you have all the advantages of configuration as code.


By using Bitbucket reviewer groups, you can configure your reviewers on a project level (see example below: frontendTeam).


And you can even share your Code Owner rules across repositories of your project by including workflows from another repository.


Here's an example:

commons/devsensei.yaml

workflows:
- name: Add Code Owners
conditions:
- destination=develop
actions:
- add-codeowners:
rules: |
*.js @@frontendTeam

repo_a/devsensei.yaml

includes:
- commons/devsensei.yaml

repo_b/devsensei.yaml

includes:
- commons/devsensei.yaml

Does that help you? You can find more information in the docs.


Best,
Michael from Mibex (app vendor of DevSensei Pull Request Workflow Automation)

Hannes Kirsman June 5, 2024

It might help in some cases where config needs to unified, tx!

I think it would not help in case you have set user to multiple repos to a group and then you have to remove them at some point so you'd have to do it multiple times.

0 votes
Hannes Kirsman March 7, 2024

Thanks for the reply!

I'm ok with copying the file around and it's content very per repo. Some repos are for front-enders, some for backenders, some for infra etc. I'd assume we would have groups like @@GroupFrontend,@@GroupBackend etc. We'd like one place to manage these groups not manage them in 10 repos. Adding same groups 10 times, removing person from it 10 times if somebody leaves. The CODEOWNSERS file probably would not change at all (ideally). I doubt some theme repo would suddenly needs backendenders group.

So we initially saw that we could do it from project level where all repos are. Then the admin who tried to add said they could not add us (probably because we don't have access to many other repos). That's the guess anyways.

Roman Stoffel March 7, 2024

Ok: So copying the CODEOWNERS file is fine at the moment.

So, in Codeowners for Bitbucket (the app, not the built in functionality), the groups can are also resolved again Bitbucket Reviewer Groups (DC), which can be defined on project or repo level.

So, in Bitbucket DC you then can have CODEOWNER files at repository level reference these reviewer groups. And update the reviewer groups at project level with new members / remove members.

On Bitbucket Cloud there is afaik no such concepts yet. There are Groups on the Workspace level, and those are used.

That are the solutions approaches that I am aware of.

PS: As mentioned we are working on more 'Project oriented' CodeOwner features for the app =). But that is in its design phase =).

0 votes
Roman Stoffel March 7, 2024

Hi.

Disclaimer: I'm working in the team for the Codeowners for Bitbucket app, which extends the built in code owner features.

Is it for Bitbucket DC or Bitbucket Cloud?


What exactly do you want to share?
1. Sharing the CODEOWNER file over a project?
2. Or are you ok with the CODEOWNER file copied over, but you want to be per-project flexible on who to assign?

For 1. In general, we are working at the moment on concepts to extend our Codeowners app to give more high level, project wide features. But that is in a very early stage.

For 2. What you could do (at least with the Codeowners for Bitbucket app) is to only use groups in the Code owner files:

```
**/*.java @@JavaExperts
frontent/* @@FrontendExperts
```

And the use Bitbucket Reviewer Groups on a per project level who is in the @@JavaExperts & @@FrontendExperts group. However, the CODEOWNER file still need copy and pasting over all projects.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events