Allow to enable imports of code owner config files with arbitrary file extensions

Code owner config files can only import other code owner config files,
but not arbitrary files. For the find-owners backend files with the
following names are considered as code owner config files: OWNERS,
<prefix>_OWNERS, OWNERS_<extension>

Having a name pattern for code owner config files defined allows the
code-owners plugin to recognise code owner config files on upload and
validate them. The validation ensures that code owner config files never
import non-parseable code owner config files. This is important, since
an import of a non-parseable code owner config file would block the
submission of all changes for which this import is relevant, which can
be a serious outage.

To support maintaining different sets of code owner configuration in one
repository/branch it is possible to configure a file extension for code
owner config files. In this case the find-owners backend considers the
following files as code owner config files: OWNERS.<file-extension>,
<prefix>_OWNERS.<file-extension>, OWNERS_<extension>.<file-extension>
(where ‘file-extension’ matches the configured file-extension, but not
arbitrary file extensions). For this use-case it is important that there
is no validation on code owner config files which belong to a different
set of code configurations (e.g. if OWNERS.google files are used, OWNERS
or OWNERS.other files should not be validated). This is important since
the validation of code owner config files which belong to a different
set of code configurations is not unlikely to fail (e.g. they may use a
different syntax or reference users that don’t exist on the host).

Now the Chrome team has the requirement to support code owner config
files with arbitrary file extensions. E.g. for the find-owners backend
OWNERS.<file-extension> should be supported in addition to OWNERS,
<prefix>_OWNERS, OWNERS_<extension>. For their use-case
OWNERS.<file-extension> files with any file extension should be
validated to prevent that they become non-parseable and can break the
submission of changes when they are being imported. This requirement
conflicts with the use case of using file extensions for code owner
config files to support different sets of code owner configurations in
one repository/branch (as explained above this use-case requires that
code owner config files with non-matching file extensions are not
validated).

To support their use-case anyway we add a new configuration option that
controls whether code owner config files with file extensions are
enabled. If code owner config files with file extensions are enabled,
code owner config files with arbitrary file extensions are validated and
can be imported by other code owner config files.

If this option is used, one should not configure a file extension for
code owner files and vice versa (as both options are not compatible as
explained above which likely causes issues).

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: If663d70067665eb6f8f1a2e261e5a380eae7de12
9 files changed
tree: ebd6764b69bf81e9bc587c4ac3231eb2feb3e46d
  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.