|
1 | | -# Team Assignment Ingestion Pipeline |
| 1 | +# Code Coverage Team Assignments |
2 | 2 |
|
3 | | -Team assignment will occur once per ci run. |
4 | | -Team assignment uses an ingest pipeline. |
| 3 | +Team assignment occurs once per ci run. |
5 | 4 |
|
6 | | -The coverage user has the coverage admin role. |
| 5 | +The "orchestration" entry point is a [Jenkinsfile Scripted Pipeline](https://github.com/elastic/kibana/blob/f73bc48b3bbbb5ad2042c1aa267aea2150b7b742/.ci/Jenkinsfile_coverage#L21) |
| 6 | +This Jenkinsfile runs a [shell script](https://github.com/elastic/kibana/blob/master/src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh#L33) that kicks everything off. |
| 7 | +The end result is the data is ingested to our [Kibana Stats Cluster](https://kibana-stats.elastic.dev/app/dashboards#/view/58b8db70-62f9-11ea-8312-7f2d69b79843?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-7d%2Cto%3Anow))) |
7 | 8 |
|
8 | | -This role must have the rights depicted below  |
| 9 | +## Team Assignment Parsing (from .github/CODEOWNERS) |
| 10 | +We add additional metadata to the CODEOWNERS file. |
| 11 | +This metadata allows users to assign teams to paths, in a friendly location. |
| 12 | +Example CODEOWNERS Block: |
| 13 | +_notice the coverage delimiter `#CC# ...`_ |
| 14 | +``` |
| 15 | +/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team @elastic/siem |
| 16 | +/x-pack/test/plugin_functional/plugins/resolver_test/ @elastic/endpoint-app-team @elastic/siem |
| 17 | +/x-pack/test/plugin_functional/test_suites/resolver/ @elastic/endpoint-app-team @elastic/siem |
| 18 | +#CC# /x-pack/legacy/plugins/siem/ @elastic/siem |
| 19 | +#CC# /x-pack/plugins/siem/ @elastic/siem |
| 20 | +#CC# /x-pack/plugins/security_solution/ @elastic/siem |
| 21 | +``` |
| 22 | +The first 3 lines above fill the usual purpose of the CODEOWNERS file and cause PRs modifying files in these paths to require approval by the listed team(s). |
| 23 | +They also attribute files in those paths for purpose of code coverage reporting. |
| 24 | +The last 3 lines above ONLY attribute files in those paths for purpose of code coverage reporting. |
| 25 | + |
| 26 | +## Team Assignment Data File Creation (Before Ingestion) |
| 27 | +We create a data file containing all paths in the repo, with a team assigned. |
| 28 | +Example Team Assignments Block: |
| 29 | +``` |
| 30 | +x-pack/plugins/security_solution/common/constants.ts siem |
| 31 | +x-pack/plugins/security_solution/common/detection_engine/build_exceptions_query.test.ts siem |
| 32 | +x-pack/plugins/security_solution/common/detection_engine/build_exceptions_query.ts siem |
| 33 | +... |
| 34 | +``` |
| 35 | + |
| 36 | +## Team Assignment Data File Usage (During Code Coverage Ingestion) |
| 37 | +Subsequently, we use the data file during ingestion. |
| 38 | +We search the data file, for any given "coveredFilePath" |
| 39 | + - Given the above assignments block, and lets say the "coveredFilePath" during ingestion is |
| 40 | + - `x-pack/plugins/security_solution/common/constants.ts` |
| 41 | + - The team assignment would be `siem` in our [Kibana Stats Cluster](https://kibana-stats.elastic.dev/app/dashboards#/view/58b8db70-62f9-11ea-8312-7f2d69b79843?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-7d%2Cto%3Anow))) |
0 commit comments