DEV Community

Javi
Javi

Posted on

Azure DevOps CODEOWNERS

So the other day I came across GitHub's CODEOWNERS feature and I really liked it. I searched for the same in Azure DevOps but couldn't find something remotely close to it. Then my entrepreneur spirit waked up and I decided to make it myself :)

But first, what is "CODEOWNERS"?

CodeOwners Feature

Some facts:

  1. When working on a multiservice monorepo, it's very common to have different programmers working on the same repo on different features.
  2. The programmer who wrote the feature is probably the one that knows best about it.
  3. Some other programmer will probably "touch" that code sometime in the future (bugfix for example).
  4. You want the Pull Request to be as professional and as short as possible.

Thus, CodeOwners came to live.

CODEOWNERS is a simple idea, each feature/service in the monorepo has an owner. A developer who "owns" that feature, knows it the best and can be held responsible, in a positive way, of that feature.
The CODEOWNERS feature in GitHub is just an easy way of enforcing that the owner will become a reviewer, automatically.

In GitHub

To make use of this feature you just need to create a file named "CODEOWNERS" in the root of the repository and add, as they show in the example, the owners of the services.
From now on every pull request that is opened will be automatically assigned to the owners.
As the CODEOWNERS file is also gitted, changes to it will also be PR'd.

In Azure DevOps

There's branch protection in Azure DevOps but it's not as powerful as CodeOwners.
I've created a simple Docker Container that adds this feature to your Azure DevOps project and works the same way.
It can also notify the owner via RocketChat :)

You can see the code here and download the image from the Docker Hub

Hope you like it!
I'm open for more ideas to add and make Azure DevOps better!

Top comments (0)