src/dev/code_coverage/docs/team_assignment/README.md
Team assignment occurs once per ci run.
The entry point is a yaml config
Within the yaml config, this shell script is used.
Search for node scripts/generate_team_assignments.js and you'll see how it is generated before ingestion begins.
The generated file's path is passed to the ingestion system via an environment variable: --teamAssignmentsPath $TEAM_ASSIGN_PATH.
The ingestion system uses it here.
We add additional metadata to the CODEOWNERS file.
This metadata allows users to assign teams to paths, in a friendly location.
Example CODEOWNERS Block:
notice the coverage delimiter #CC# ...
/x-pack/solutions/security/test/fixtures/es_archives/endpoint/ @elastic/endpoint-app-team @elastic/siem
#CC# /x-pack/legacy/plugins/siem/ @elastic/siem
#CC# /x-pack/plugins/siem/ @elastic/siem
#CC# /x-pack/solutions/security/plugins/security_solution/ @elastic/siem
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).
They also attribute files in those paths for purpose of code coverage reporting.
The last 3 lines above ONLY attribute files in those paths for purpose of code coverage reporting.
We create a data file containing all paths in the repo, with a team assigned.
Example Team Assignments Block:
x-pack/solutions/security/plugins/security_solution/common/constants.ts siem
x-pack/solutions/security/plugins/security_solution/common/detection_engine/build_exceptions_query.test.ts siem
x-pack/solutions/security/plugins/security_solution/common/detection_engine/build_exceptions_query.ts siem
...
Subsequently, we use the data file during ingestion. We search the data file, for any given "coveredFilePath"
x-pack/solutions/security/plugins/security_solution/common/constants.tssiem in our Kibana Stats Cluster