-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Test Owners] Add script to get owners for files #193277
Conversation
/ci |
d0d9d56
to
e300b83
Compare
/ci |
"node scripts/build_api_docs --plugin @kbn/code-owners --stats comments"
@elasticmachine merge upstream |
const targetFile = flags.file as string; | ||
if (!targetFile) throw createFlagError(`Missing --flag argument`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check if provided argument is actually a valid existing path?
Did some testing and I would expect error pointing the path is incorrect for the last 2 calls:
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file packages/kbn-ace/src/ace/modes/index.ts
succ elastic/kibana-management
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file packages/kbn-ace/src/ace/modes
succ elastic/kibana-management
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file packages/kbn-ace/src/ace/mode
succ elastic/kibana-management
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file packages/kbn-ace/src/ace/x
succ elastic/kibana-management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmm, as I understand it, the codewoners resolution is essentially looking for files and folders.
Such that, if a file is not found, the result can be a parent dir (depending how the ownership is declared [specific file vs folder]). This is my guess on the algo; that's how I do it manually.
That said, $ node scripts/get_owners_for_file.js --file packages/kbn-ace/src/ace/x
:
succ elastic/kibana-management
...gives me pause.
Lemme see what I can discover.
Good catch mate!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIx?
Sorry about the force push. I was in a meeting showing someone something and ran a rebase in the wrong dir. Wont happen again (after opening pr's for review)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries, checking...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message seems to be off. It mentions a --flag
argument, that's not present in the args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see the new script, left a question about path validation
5731de1
to
ea3b979
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
general question:
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file x-pack/test/api_integration/deployment_agnostic
ERROR Ownership of file [x-pack/test/api_integration/deployment_agnostic] is UNKNOWN
[get-owners-for-files][~/github/kibana]$ node scripts/get_owners_for_file.js --file x-pack/test/api_integration/deployment_agnostic/default_configs
succ elastic/appex-qa,#temporarily,to,monitor,tests,migration
It seems to be fine that "root" test directory has no owners as long as all of it child folders (or their child folders, etc...) have owners. Do I see it the right way?
x-pack/test/api_integration/deployment_agnostic
may not have explicit owner, but
x-pack/test/api_integration/deployment_agnostic/default_configs
x-pack/test/api_integration/deployment_agnostic/services
...
should either have one, or their files should. wdyt?
Yes I believe that is correct. We will know more once we get closer to having zero files/folders without ownership in |
b0d89f3
to
ea3b979
Compare
Force pushed again to see if I can stop the auto-commit which kicked off a ton of extra tests that have nothing to do with my pr |
💚 Build Succeeded
Metrics [docs]History
To update your PR or re-run it, just comment with: |
{ | ||
description: 'Report file ownership from GitHub CODEOWNERS file.', | ||
flags: { | ||
string: ['file'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delanni is this not it bud?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delanni Haven't heard from ya man. Gonna merge this soon. Please lemme know if you've an objection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't see the message.
I meant the wording of the error:
throw createFlagError(`Missing --flag argument`);
but there's no --flag
argument, it's --file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhhhh!!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Summary Modify code owner declarations for @elastic/response-ops team in `.github/CODEOWNERS` ### Update for Reviewers With the merge of [this](#193277), you can now do this: `node scripts/get_owners_for_file.js --file x-pack/test/functional/es_archives/action_task_params` ``` succ elastic/response-ops ``` _So, you can use this script to see if the code owners file is reporting erroneously_ ### For Reviewers Added these lines: ``` /x-pack/test/functional/es_archives/actions @elastic/response-ops /x-pack/test/functional/es_archives/alerting @elastic/response-ops /x-pack/test/functional/es_archives/alerts @elastic/response-ops /x-pack/test/functional/es_archives/alerts_legacy @elastic/response-ops /x-pack/test/functional/es_archives/observability/alerts @elastic/response-ops /x-pack/test/functional/es_archives/actions @elastic/response-ops /x-pack/test/functional/es_archives/rules_scheduled_task_id @elastic/response-ops /x-pack/test/functional/es_archives/alerting/8_2_0 @elastic/response-ops ``` Most of these changes come from searching for `esArchiver.load`, within `x-pack/test/alerting_api_integration` Obviously this can easily be erroneous, so please keep me honest. #### Notes This is a best guess effort, as we march towards having zero files within `test` && `x-pack/test` && `x-pack/test_serverless` without a code owner. In the end, this will contribute to better reporting. Contribues to: #192979 --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
## Summary Follow up of [incorrect wording](#193277 (comment))
#193571) ## Summary Modify code owner declarations for @elastic/security-detection-engine team in `.github/CODEOWNERS` ### Update for Reviewers With the merge of [this](#193277), you can now do this: `node scripts/get_owners_for_file.js --file x-pack/test/functional/es_archives/asset_criticality` ``` succ elastic/security-detection-engine ``` _So, you can use this script to see if the code owners file is reporting erroneously_ ### Only one un-contested change: 1. `/x-pack/test/functional/es_archives/asset_criticality @elastic/security-detection-engine` ### Note Oringinally I included `/x-pack/test/functional/es_archives/security_solution @elastic/security-detection-engine` but this was contested. We will circle back around to this. Contributes to: #192979 --------- Co-authored-by: Elastic Machine <[email protected]>
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
Unknown Path
node scripts/get_owners_for_file.js --file some-file.txt
Error Path
node scripts/get_owners_for_file.js
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: #192979