commit | 85de10d412fb719c29901a7010f363276f95c4df | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Thu Jul 01 14:41:15 2021 +0200 |
committer | Edwin Kempin <ekempin@google.com> | Thu Jul 01 15:00:05 2021 +0200 |
tree | e96ca39f48a51b5fe1684f76b6ee2b02e342edb4 | |
parent | b503d729b323553d1cd924e0efd92d0f96dda514 [diff] |
Fix error handling for per-file imports that use import mode ALL Code owner config files can import other code owner config files. Which rules are being imported depends on the import mode: * ALL: all rules are imported * GLOBAL_CODE_OWNER_SETS_ONLY: only rules for global code owners are imported (aka folder code owners) For per-file code owner sets only imports with mode GLOBAL_CODE_OWNER_SETS_ONLY are allowed. If the find-owners backend is used, the import keyword controls which import mode is being used: * include = ALL * file: = GLOBAL_CODE_OWNER_SETS_ONLY OWNERS files with a per-file rule that use the include keyword, although the include keyword is not allowed for per-file rules, are rejected as non-parseable. However instead of throwing a CodeOwnerConfigParseException, FindOwnersConfigParser throwed an IllegalStateException. This was bad because IllegalStateExceptions are causing internal server errors, whereas CodeOwnerConfigParseExceptions are handled as configuration errors. Configuration errors make requests fail with 409 Conflict and a proper error message, or if they occur during the submit rule evaluation they cause the status to be set to RULE_ERROR. This way the user can find out what's wrong and fix the bad OWNERS file. While we are at this, improve the error message. Talking about import mode ALL doesn't make sense from a user's perspective. Rather tell them directly that the include keyword is not supported for per-file rules. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I382aae540dcc69fcda30a565c75aa696a866664c
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.