CodeOwnersSubmitRule: Treat invalid plugin configuration as RULE_ERROR

In case of a failure submit rules can throw an exception or return a
RULE_ERROR.

An exception should be thrown in case of server errors that should count
against Gerrit’s SLO’s and that need to be investigated by the Gerrit
team.

A RULE_ERROR should be returned in case a failure is caused by bad
configuration that is under the control of host and project owners. In
this case it’s the responsibility of the host/project owner to fix the
configuration and the error should not count against Gerrit's SLO’s.

Since the code-owners plugin configuration is maintained by the
host/project owners, any failure that is caused by a bad configuration
should be treated as RULE_ERROR, but so far we threw an exception.

Fixing this allows us to run the code-owners tests that verify the
behaviour when the plugin configuration is invalid against the fake
index. Before this change these tests failed when running against the
fake index because the fake index is more strict when exceptions occur
during the indexing. With the fake index exceptions are propagated,
whereas with other index implementations they are swallowed (which means
that the exception is caught, but the change is not indexed). For the
code-owners plugin this meant that creating changes was possible when
the code-owners plugin configuration was invalid, but these changes
didn't get indexed. With this fix, they are indexed now and only the
code-owners submit requirement in the index says RULE_ERROR.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I1ec13548b42f541cc40fcc651e997d374b08ee02
2 files changed
tree: b65dac1a595c67af4d18a502c1f1505bd8419baf
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. 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.

Also see resources/Documentation/about.md.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.