Show that the overrideIf of a configured Code-Owners SR has no effect

Whether a change is code-owner approved is checked by the (hard-coded)
code owners submit rule. This submit rule respects overrides that comply
with the label that is configured as override in the code-owners plugin
configuration.

If a Code-Owners submit requirement is manually configured in
project.config it conflicts with the (hard-coded) code owners submit
rule. If submit requirements conflict the change only gets submittable
when both submit requirements pass.

This means if the Code-Owners submit requirement has a different
overrideIf condition than what's configured in the code-owners plugin
configuration it has no effect:

1. If the overrideIf is satisfied it doesn't count as an override for
   the (hard-coded) code owners submit rule so this submit rule is still
   not passing and hence the change doesn't get submittable.

2. If the override that is configured in the code-owners plugin
   configuration is satisfied the (hard-coded) code owners submit rule
   is passing. If the Code-Owners submit requirement uses
   "has:approval_code-owners" as submittableIf condition it is passing
   now too since "has:approval_code-owners" just means to check if the
   (hard-coded) code owners submit rule passes.

This means the overrideIf condition of a configured Code-Owners submit
requirement can neither replace nor add to the override condition that
is configured in the code-owners plugin configuration.

This also means defining a Code-Owners submit requirement that has an
overrideIf condition that is different from the override condition that
is configured in the code-owners plugin configuration has no effect and
is only confusing as the overrideIf condition from the Code-Owners
submit requirement is shown in the UI but doesn't work.

Change-Id: I5bfe4a45ad4e2ec67fae5ec3681012537e7b6a63
Signed-off-by: Edwin Kempin <ekempin@google.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/plugins/code-owners/+/412560
Reviewed-by: Patrick Hiesel <hiesel@google.com>
Tested-by: Zuul <zuul-63@gerritcodereview-ci.iam.gserviceaccount.com>
1 file changed
tree: 431c87a87f5a9dfa1ed77638450bd2149ea03839
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. web/
  6. .gitignore
  7. .gitreview
  8. BUILD
  9. LICENSE
  10. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

For a detailed description of the plugin functionality please refer to the plugin documentation.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide.

NOTE: The plugin documentation only renders correctly when the plugin is installed in Gerrit and the documentation is accessed via https:///plugins/code-owners/Documentation/index.html. If you want to read the documentation before installing the plugin, you can find it properly rendered here.

JavaScript Plugin

From the root of the gerrit repository.

bazel test //plugins/code-owners/web:karma_test

For testing the plugin with the Gerrit FE Dev Helper the command below builds

    bazel build //plugins/code-owners/web:code-owners
    ln -s bazel-bin/plugins/code-owners/web/code-owners.js polygerrit-ui/app/plugins/

and let the Dev Helper redirect from .+/plugins/code-owners/static/code-owners.js to http://localhost:8081/plugins/code-owners.js.