Skip to content

Commit

Permalink
[QA][Code Coverage] Coverage teams lookup w/o Additional Config (#77111)
Browse files Browse the repository at this point in the history
* [QA][Code Coverage] Coverage teams lookup

* Fix test per cr.

* Drop unused fn's.

* Add integration test to prove that the sys does indeed
strip the CC prefix and still walks the fs.

* Cleanup "todo" list.

* Use import, like Dima's previous suggestion.

* Add coverage teams only definitions to CODEOWNERS per Lee.

* Add coverage teams for logstash, reporting and security.

* Update description.

* Update names per Lee.

* Drop mutation.

* Fix dupes.

* Add the file check, per Dima

* Add more teams

* Update regex to only match on "build/" and add test.

* More teams

* More teams

* Add print statement of the canonical timestamp,
so we can lookup stuff in gcp during errors.

* CR fixups
  • Loading branch information
wayneseymour authored Sep 28, 2020
1 parent 085cac1 commit 3a73e0b
Show file tree
Hide file tree
Showing 36 changed files with 1,051 additions and 208 deletions.
14 changes: 11 additions & 3 deletions .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ kibanaPipeline(timeoutMinutes: 240) {
]) {
workers.base(name: 'coverage-worker', size: 'l', ramDisk: false, bootstrapped: false) {
catchError {

kibanaPipeline.bash("""
echo '${TIME_STAMP}'
""", "### Print Canonical Time Stamp")

kibanaCoverage.runTests()
kibanaTeamAssign.load('team_assignment', "### Upload Team Assignment JSON")
handleIngestion(TIME_STAMP)
}
handleFail()
Expand All @@ -30,7 +34,7 @@ def handleIngestion(timestamp) {
kibanaCoverage.collectVcsInfo("### Collect VCS Info")
kibanaCoverage.generateReports("### Merge coverage reports")
kibanaCoverage.uploadCombinedReports()
kibanaCoverage.ingest(env.JOB_NAME, BUILD_NUMBER, BUILD_URL, timestamp, previousSha, '### Ingest && Upload')
kibanaCoverage.ingest(env.JOB_NAME, BUILD_NUMBER, BUILD_URL, timestamp, previousSha, teamAssignmentsPath(), '### Generate Team Assignments && Ingest')
kibanaCoverage.uploadCoverageStaticSite(timestamp)
}

Expand All @@ -42,11 +46,15 @@ def handlePreviousSha() {

def handleFail() {
def buildStatus = buildUtils.getBuildStatus()
if(params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED' && buildStatus != 'UNSTABLE') {
if (params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED' && buildStatus != 'UNSTABLE') {
slackNotifications.sendFailedBuild(
channel: '#kibana-qa',
username: 'Kibana QA'
)
}
}

def teamAssignmentsPath() {
return 'src/dev/code_coverage/ingest_coverage/team_assignment/team_assignments.txt'
}

129 changes: 129 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Identify which groups will be pinged by changes to different parts of the codebase.
# For more info, see https://help.github.com/articles/about-codeowners/

# The #CC# prefix delineates Code Coverage,
# used for the 'team' designator within Kibana Stats

# App
/x-pack/plugins/dashboard_enhanced/ @elastic/kibana-app
/x-pack/plugins/discover_enhanced/ @elastic/kibana-app
Expand All @@ -26,6 +29,33 @@
/src/plugins/vis_type_xy/ @elastic/kibana-app
/src/plugins/visualize/ @elastic/kibana-app
/src/plugins/visualizations/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
#CC# /src/plugins/vis_type @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/common/utils @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/migrations @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
#CC# /src/legacy/core_plugins/console_legacy @elastic/kibana-app
#CC# /src/legacy/core_plugins/input_control_vis @elastic/kibana-app
#CC# /src/legacy/core_plugins/timelion @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_tagcloud @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vega @elastic/kibana-app
#CC# /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
#CC# /src/legacy/server/sample_data/ @elastic/kibana-app
#CC# /src/legacy/server/url_shortening/ @elastic/kibana-app
#CC# /src/legacy/ui/public/state_management @elastic/kibana-app
#CC# /src/plugins/charts/public/static/color_maps @elastic/kibana-app
#CC# /src/plugins/index_pattern_management/public @elastic/kibana-app
#CC# /src/plugins/input_control_vis/ @elastic/kibana-app
#CC# /src/plugins/kibana_legacy/ @elastic/kibana-app
#CC# /src/plugins/timelion @elastic/kibana-app
#CC# /x-pack/legacy/plugins/dashboard_mode/ @elastic/kibana-app
#CC# /x-pack/plugins/dashboard_mode @elastic/kibana-app
#CC# /x-pack/plugins/lens/ @elastic/kibana-app

# App Architecture
/examples/bfetch_explorer/ @elastic/kibana-app-arch
Expand Down Expand Up @@ -56,12 +86,37 @@
/x-pack/plugins/data_enhanced/ @elastic/kibana-app-arch
/x-pack/plugins/embeddable_enhanced/ @elastic/kibana-app-arch
/x-pack/plugins/ui_actions_enhanced/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/kibana/public/management/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/kibana/server/routes/api/management/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/embeddable_api/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/interpreter/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/kibana_react/ @elastic/kibana-app-arch
#CC# /src/legacy/core_plugins/status_page/public @elastic/kibana-app-arch
#CC# /src/legacy/server/index_patterns/ @elastic/kibana-app-arch
#CC# /src/legacy/ui/public/field_editor @elastic/kibana-app-arch
#CC# /src/legacy/ui/public/management @elastic/kibana-app-arch
#CC# /src/plugins/advanced_settings/ @elastic/kibana-app-arch
#CC# /src/plugins/bfetch/ @elastic/kibana-app-arch
#CC# /src/plugins/charts/ @elastic/kibana-app-arch
#CC# /src/plugins/index_pattern_management/public/service @elastic/kibana-app-arch
#CC# /src/plugins/inspector/ @elastic/kibana-app-arch
#CC# /src/plugins/saved_objects/ @elastic/kibana-app-arch
#CC# /src/plugins/share/ @elastic/kibana-app-arch
#CC# /src/plugins/vis_default_editor @elastic/kibana-app-arch
#CC# /x-pack/plugins/advanced_ui_actions/ @elastic/kibana-app-arch
#CC# /x-pack/plugins/drilldowns/ @elastic/kibana-app-arch
#CC# /packages/kbn-interpreter/ @elastic/kibana-app-arch

# APM
/x-pack/plugins/apm/ @elastic/apm-ui
/x-pack/test/functional/apps/apm/ @elastic/apm-ui
/src/plugins/apm_oss/ @elastic/apm-ui
/src/apm.js @watson @vigneshshanmugam
#CC# /src/plugins/apm_oss/ @elastic/apm-ui
#CC# /src/legacy/core_plugins/apm_oss/ @elastic/apm-ui
#CC# /src/legacy/ui/public/apm @elastic/apm-ui
#CC# /x-pack/legacy/plugins/apm/ @elastic/apm-ui
#CC# /x-pack/plugins/observability/ @elastic/apm-ui

# Client Side Monitoring (lives in APM directories but owned by Uptime)
/x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm @elastic/uptime
Expand All @@ -71,20 +126,32 @@
/x-pack/plugins/apm/server/lib/rum_client @elastic/uptime
/x-pack/plugins/apm/server/routes/rum_client.ts @elastic/uptime
/x-pack/plugins/apm/server/projections/rum_page_load_transactions.ts @elastic/uptime
/x-pack/plugins/apm/server/projections/rum_overview.ts @elastic/uptime
#CC# /x-pack/legacy/plugins/uptime @elastic/uptime

# Beats
/x-pack/plugins/beats_management/ @elastic/beats
/x-pack/legacy/plugins/beats_management/ @elastic/beats
#CC# /x-pack/plugins/beats_management/ @elastic/beats

# Canvas
/x-pack/plugins/canvas/ @elastic/kibana-canvas
/x-pack/test/functional/apps/canvas/ @elastic/kibana-canvas
#CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-canvas
#CC# /x-pack/legacy/plugins/canvas/ @elastic/kibana-canvas

# Core UI
# Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon
/src/plugins/home/public @elastic/kibana-core-ui
/src/plugins/home/server/*.ts @elastic/kibana-core-ui
/src/plugins/home/server/services/ @elastic/kibana-core-ui
/x-pack/plugins/global_search_bar/ @elastic/kibana-core-ui
#CC# /src/legacy/core_plugins/newsfeed @elastic/kibana-core-ui
#CC# /src/plugins/newsfeed @elastic/kibana-core-ui
#CC# /src/plugins/home/public @elastic/kibana-core-ui
#CC# /src/plugins/home/server/services/ @elastic/kibana-core-ui
#CC# /src/plugins/home/ @elastic/kibana-core-ui
#CC# /x-pack/plugins/global_search_providers/ @elastic/kibana-core-ui

# Observability UIs
/x-pack/plugins/infra/ @elastic/logs-metrics-ui
Expand All @@ -110,6 +177,14 @@
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
#CC# /src/legacy/core_plugins/region_map @elastic/kibana-gis
#CC# /src/legacy/core_plugins/tile_map @elastic/kibana-gis
#CC# /src/plugins/maps_legacy/ @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis
#CC# /x-pack/plugins/maps_legacy_licensing @elastic/kibana-gis
#CC# /src/plugins/home/server/tutorials @elastic/kibana-gis
#CC# /src/plugins/tile_map/ @elastic/kibana-gis
#CC# /src/plugins/region_map/ @elastic/kibana-gis

# Operations
/src/dev/ @elastic/kibana-operations
Expand All @@ -132,6 +207,7 @@
/src/legacy/server/warnings/ @elastic/kibana-operations
/.ci/es-snapshots/ @elastic/kibana-operations
/vars/ @elastic/kibana-operations
#CC# /packages/kbn-expect/ @elastic/kibana-operations

# Quality Assurance
/src/dev/code_coverage @elastic/kibana-qa
Expand All @@ -158,6 +234,31 @@
/src/plugins/status_page/ @elastic/kibana-platform
/src/plugins/saved_objects_management/ @elastic/kibana-platform
/src/dev/run_check_published_api_changes.ts @elastic/kibana-platform
#CC# /src/core/server/csp/ @elastic/kibana-platform
#CC# /src/legacy/core_plugins/kibana/server/lib @elastic/kibana-platform
#CC# /src/legacy/core_plugins/kibana/server/lib/management/saved_objects @elastic/kibana-platform
#CC# /src/legacy/core_plugins/kibana/server/routes/api/import/ @elastic/kibana-platform
#CC# /src/legacy/core_plugins/kibana/server/routes/api/export/ @elastic/kibana-platform
#CC# /src/legacy/core_plugins/elasticsearch @elastic/kibana-platform
#CC# /src/legacy/core_plugins/testbed @elastic/kibana-platform
#CC# /src/legacy/server/config/ @elastic/kibana-platform
#CC# /src/legacy/server/http/ @elastic/kibana-platform
#CC# /src/legacy/server/status/ @elastic/kibana-platform
#CC# /src/legacy/ui/public/new_platform @elastic/kibana-platform
#CC# /src/legacy/ui/public/plugin_discovery @elastic/kibana-platform
#CC# /src/legacy/ui/public/chrome @elastic/kibana-platform
#CC# /src/legacy/ui/public/notify @elastic/kibana-platform
#CC# /src/legacy/ui/public/documentation_links @elastic/kibana-platform
#CC# /src/legacy/ui/public/autoload @elastic/kibana-platform
#CC# /src/plugins/legacy_export/ @elastic/kibana-platform
#CC# /src/plugins/status_page/ @elastic/kibana-platform
#CC# /src/plugins/testbed/server/ @elastic/kibana-platform
#CC# /x-pack/legacy/plugins/xpack_main/server/ @elastic/kibana-platform
#CC# /x-pack/legacy/server/lib/ @elastic/kibana-platform
#CC# /x-pack/plugins/cloud/ @elastic/kibana-platform
#CC# /x-pack/plugins/features/ @elastic/kibana-platform
#CC# /x-pack/plugins/global_search/ @elastic/kibana-platform
#CC# /src/legacy/plugin_discovery/ @elastic/kibana-platform

# Security
/src/core/server/csp/ @elastic/kibana-security @elastic/kibana-platform
Expand All @@ -177,12 +278,19 @@
/x-pack/test/security_functional/ @elastic/kibana-security
/x-pack/test/spaces_api_integration/ @elastic/kibana-security
/x-pack/test/token_api_integration/ @elastic/kibana-security
#CC# /src/legacy/ui/public/capabilities @elastic/kibana-security
#CC# /x-pack/legacy/plugins/encrypted_saved_objects/ @elastic/kibana-security
#CC# /x-pack/plugins/security_solution/ @elastic/kibana-security
#CC# /x-pack/plugins/security/ @elastic/kibana-security
#CC# /x-pack/plugins/audit_trail/ @elastic/kibana-security

# Kibana Localization
/src/dev/i18n/ @elastic/kibana-localization
/src/legacy/server/i18n/ @elastic/kibana-localization
/src/core/public/i18n/ @elastic/kibana-localization
/packages/kbn-i18n/ @elastic/kibana-localization
#CC# /src/legacy/server/i18n/ @elastic/kibana-localization
#CC# /x-pack/plugins/translations/ @elastic/kibana-localization

# Kibana Telemetry
/packages/kbn-analytics/ @elastic/kibana-telemetry
Expand Down Expand Up @@ -211,6 +319,11 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services
#CC# /x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
#CC# /x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
#CC# /x-pack/legacy/plugins/task_manager @elastic/kibana-alerting-services
#CC# /x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
#CC# /x-pack/plugins/alerting_builtins @elastic/kibana-alerting-services

# Enterprise Search
# Shared
Expand Down Expand Up @@ -248,6 +361,12 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/ingest_pipelines/ @elastic/es-ui
/packages/kbn-ace/ @elastic/es-ui
/packages/kbn-monaco/ @elastic/es-ui
#CC# /x-pack/legacy/plugins/rollup/ @elastic/es-ui
#CC# /x-pack/legacy/server/lib/create_router/ @elastic/es-ui
#CC# /x-pack/legacy/server/lib/check_license/ @elastic/es-ui
#CC# /x-pack/plugins/console_extensions/ @elastic/es-ui
#CC# /x-pack/plugins/cross_cluster_replication/ @elastic/es-ui
#CC# /x-pack/plugins/es_ui_shared/ @elastic/es-u

# Endpoint
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team @elastic/siem
Expand All @@ -257,6 +376,9 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/test/functional/es_archives/endpoint/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/plugin_functional/plugins/resolver_test/ @elastic/endpoint-app-team @elastic/siem
/x-pack/test/plugin_functional/test_suites/resolver/ @elastic/endpoint-app-team @elastic/siem
#CC# /x-pack/legacy/plugins/siem/ @elastic/siem
#CC# /x-pack/plugins/siem/ @elastic/siem
#CC# /x-pack/plugins/security_solution/ @elastic/siem

# Security Solution
/x-pack/plugins/security_solution/ @elastic/siem @elastic/endpoint-app-team
Expand All @@ -271,6 +393,7 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib

# Design (at the bottom for specificity of SASS files)
**/*.scss @elastic/kibana-design
#CC# /packages/kbn-ui-framework/ @elastic/kibana-design

# Core design
/src/plugins/dashboard/**/*.scss @elastic/kibana-core-ui-designers
Expand All @@ -292,3 +415,9 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
/x-pack/plugins/endpoint/**/*.scss @elastic/security-design
/x-pack/plugins/security_solution/**/*.scss @elastic/security-design

# Logstash
#CC# /x-pack/plugins/logstash/ @elastic/logstash

# Reporting
#CC# /x-pack/plugins/reporting/ @elastic/kibana-reporting-services

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*/

require('../src/setup_node_env');
require('../src/dev/code_coverage/ingest_coverage/team_assignment').uploadTeamAssignmentJson();
require('../src/dev/code_coverage/ingest_coverage/team_assignment').generateTeamAssignments();
16 changes: 15 additions & 1 deletion src/dev/code_coverage/ingest_coverage/__tests__/either.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe(`either datatype functions`, () => {
expect(sut.inspect()).to.be('Right(undefined)');
});
});
describe(`'fromNullable`, () => {
describe(`fromNullable`, () => {
it(`should continue processing if a truthy is calculated`, () => {
attempt({ detail: 'x' }).fold(
() => {},
Expand All @@ -64,4 +64,18 @@ describe(`either datatype functions`, () => {
attempt(false).fold(expectNull, () => {});
});
});
describe(`predicate fns`, () => {
it(`right.isRight() is true`, () => {
expect(Either.right('a').isRight()).to.be(true);
});
it(`right.isLeft() is false`, () => {
expect(Either.right('a').isLeft()).to.be(false);
});
it(`left.isLeft() is true`, () => {
expect(Either.left().isLeft()).to.be(true);
});
it(`left.isRight() is true`, () => {
expect(Either.left().isRight()).to.be(false);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';
import { enumeratePatterns } from '../team_assignment/enumerate_patterns';
import { ToolingLog, REPO_ROOT } from '@kbn/dev-utils';

const log = new ToolingLog({
level: 'info',
writeTo: process.stdout,
});

describe(`enumeratePatterns`, () => {
it(`should resolve x-pack/plugins/reporting/server/browsers/extract/unzip.js to kibana-reporting`, () => {
const actual = enumeratePatterns(REPO_ROOT)(log)(
new Map([['x-pack/plugins/reporting', ['kibana-reporting']]])
);

expect(
actual[0].includes(
'x-pack/plugins/reporting/server/browsers/extract/unzip.js kibana-reporting'
)
).to.be(true);
});
it(`should resolve src/plugins/charts/public/static/color_maps/color_maps.ts to kibana-app`, () => {
const actual = enumeratePatterns(REPO_ROOT)(log)(
new Map([['src/plugins/charts/public/static/color_maps', ['kibana-app']]])
);

expect(actual[0][0]).to.be(
'src/plugins/charts/public/static/color_maps/color_maps.ts kibana-app'
);
});
it(`should resolve x-pack/plugins/security_solution/public/common/components/exceptions/builder/translations.ts to kibana-security`, () => {
const short = 'x-pack/plugins/security_solution';
const actual = enumeratePatterns(REPO_ROOT)(log)(new Map([[short, ['kibana-security']]]));

expect(
actual[0].includes(
`${short}/public/common/components/exceptions/builder/translations.ts kibana-security`
)
).to.be(true);
});
});
Loading

0 comments on commit 3a73e0b

Please sign in to comment.