commit | 60d92c8f1dddbc23f33ed3bb4e1a578234dd28ed | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Thu Jul 15 10:56:24 2021 +0200 |
committer | Edwin Kempin <ekempin@google.com> | Thu Jul 15 11:50:57 2021 +0200 |
tree | 3f18de7ef69891c6bfaa19408b3842a7f6b52492 | |
parent | 21053478252582f5e9ad054b9c17ae2d97ae863a [diff] |
Fix transitive imports of code owner configs If an OWNERS file imports another OWNERS file without specifying a project for the imported OWNERS file, the imported OWNERS file should be loaded from the same project that contains the importing OWNERS file. E.g. if foo-project:/OWNERS imports /sub/OWNERS then /sub/OWNERS should be loaded from the foo-project project. The same is true when imports are done transitively. E.g. if foo-project:/OWNERS imports bar-project:/OWNERS which imports /sub/OWNERS then /sub/OWNERS should be loaded from the bar-project project (because bar-project is the project that contains the OWNERS file that imports /sub/OWNERS). Now the resolution of the project for transitive imports was always wrongly using the project of the first OWNERS file in the import chain, so that in the example above it wrongly tried to load /sub/OWNERS from foo-project:/sub/OWNERS. Similarly when an OWNERS file imports another OWNERS file with a relative path, the path should be resolved relative to the path that contains the importing OWNERS file. E.g. if /foo/OWNERS imports sub/OWNERS then sub/OWNERS should be loaded from /foo/sub/OWNERS. The same is true when imports are done transitively. E.g. if /foo/OWNERS imports /bar/OWNERS which imports sub/OWNERS then sub/OWNERS should be loaded from /bar/sub/OWNERS (because /bar is the folder that contains the OWNERS file that imports sub/OWNERS). Also here the resolution of the relative path always wrongly used the path of the first OWNERS file in the import chain as a base so that in the example above it wrongly tried to load sub/OWNERS from /foo/sub/OWNERS. Due to fixing the issue with the relative path resolution we need to adapt a test in CheckCodeOwnerIT that expected the wrong path in the debug logs (to make the assertion work we simply use an absolute path for the test now). Bug: Google b/193664436 Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Idc04977f05ed907e73b8c54b89c12c8375691759
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.