Match plugins folder name with plugin name

Typically plugins are linked to gerrit/plugins using their repository
name that is 'owners' in this case.

Change-Id: I4a4b8052d66d9d48a165671f39424b3b039f9d60
4 files changed
tree: d71a25027d9a65f7a221e22a0c1c0f65089e2ae9
  1. gerrit-owners/
  2. gerrit-owners-autoassign/
  3. gerrit-owners-common/
  4. .gitignore
  5. BUCK
  7. common.defs

Gerrit OWNERS Plugin

This plugin provides a Prolog predicate add_owner_approval/3 that appends label('Owner-Approval', need(_)) to a provided list.

Owner approval is determined based on OWNERS files located in the same repository. They are resolved against the state present in the existing master branch.

The OWNERS files are represented by the following YAML structure:

inherited: true

This translates to inheriting owner email address from any parent OWNER files and to allow and to approve the change.

The plugin analyzes the latest patch set by looking at each patch and building an OWNERS hierarchy. It stops once it finds an OWNERS file that has “inherited” set to false (by default it’s true.)

For example, imagine the following tree:


If you submit a patch set that changes /example/src/main/java/com/example/foo/ then the plugin will first open /example/src/main/OWNERS and if inherited is set to true combine it with the owners listed in /OWNERS.

If for each patch there is a reviewer who gave a Code-Review +2 then the plugin will not add any labels, otherwise it will add label('Owner-Approval', need(_)).

Here’s a sample that uses this predicate to enable the submit rule.

submit_rule(S) :-
  D =.. [submit | Ds],
  findall(U, gerrit:commit_label(label('Code-Review', 2), U), Approvers),
  gerrit_owners:add_owner_approval(Approvers, Ds, A),
  S =.. [submit | A].

Auto assigner

There is a second plugin, gerrit-owners-autoassign which depends on gerrit-owners. It will automatically assign all of the owners to review a change when it's created or updated.