Currently we remove CODEOWNERS on backport branches to avoid review
assignments: reviews were already collected on the source pull request.
If there's a conflict, it will go through another round of review but
not require all the original assignees.
We want to re-add the file for our own tooling, and to avoid CODEOWNERS
merge conflicts on backports. To do this, we're going to add a global
override to code assignments on backport branches.
This updates our CODEOWNERS libraries to ignore assignments to
`kibanamachine`.
---------
Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
## Summary
This PR modifies the code owners check to allow "file" matches for
"directory" entries.
### Details
Taking the code owner entry
`/x-pack/test_serverless/**/test_suites/**/ml/ @elastic/ml-ui` as an
example. Note the trailing slash in the path, indicating a directory.
Before this PR, if we asked the script for the code owner of
`x-pack/test_serverless/functional/test_suites/security/ml`, it would
not match, because this requested path doesn't have the trailing slash,
thus asking for the file `ml` and not the directory. While this is
technically correct, it's just too easy to overlook this detail and get
a false negative as a result.
This PR is removing trailing slashes from the code owners entries when
adding them to the lookup table, so they now match both, directory and
file requests (and requests for everything within the directory). So
going back to the example, all these owner requests would be matched and
return `@elastic/ml-ui` as the owner:
* `x-pack/test_serverless/functional/test_suites/security/ml`
* `x-pack/test_serverless/functional/test_suites/security/ml/`
* `x-pack/test_serverless/functional/test_suites/security/ml/index.ts`
## Summary
Node script to report ownership of a given file in our repo.
The script's source of truth is `.github/CODEOWNERS`, which is generated
by `@kbn/generate`
In order to reach the goal of have zero files without code ownership,
this is one small step along the way.
### To Test
#### Happy Path
`node scripts/get_owners_for_file.js --file
packages/kbn-ace/src/ace/modes/index.ts`
```
succ elastic/kibana-management
```
#### Unknown Path
`node scripts/get_owners_for_file.js --file some-file.txt`
```
ERROR Ownership of file [some-file.txt] is UNKNOWN
```
#### Error Path
`node scripts/get_owners_for_file.js`
```
ERROR Missing --flag argument
node scripts/get_owners_for_file.js
Report file ownership from GitHub CODEOWNERS file.
Options:
--file Required, path to the file to report owners for.
--verbose, -v Log verbosely
--debug Log debug messages (less than verbose)
--quiet Only log errors
--silent Don't log anything
--help Show this message
```
### Notes
Along with this small pr, next will be to ensure owners are assigned to
all ES and KBN Archives. See more info in the link below:
Contributes to: https://github.com/elastic/kibana/issues/192979
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary
This PR adds a script that determines GitHub code ownership for
functional test files in the Kibana repository.
### Why do we need this?
We want to be able to determine test ownership to allow teams to get a
better overview of their tests (number of tests, number of skipped
tests, number of failures in the last x days, etc).
### What does this PR bring?
This PR is a first step on closing the test ownership gaps. It adds
functionality to determine the GitHub code owner for a given file (in
the `@kbn/code-owners` package) and adds a script that makes use of this
to check if all functional test files have a code owner, reporting the
gaps.
### Future plans
The idea is to include the test ownership information in our ingested
test results, such that we can create dashboards, reports, etc based on
it.
At some point (once all ownership gaps are closed), we might consider
running this check on CI to prevent new test files without owners.
### How to run?
```
node scripts/check_ftr_code_owners.js
```
The script lists the functional test files that are not covered by code
owners and also gives a summary like this:
```
ERROR Found 2592 test files without code owner (checked 7550 test files in 12.73 s)
```