From ad289f35f57dcf6ab797f572c9d4ace9e8dea2de Mon Sep 17 00:00:00 2001 From: Gerard Soldevila Date: Wed, 18 Dec 2024 21:10:50 +0100 Subject: [PATCH] Sustainable Kibana Architecture: Move modules owned by `@elastic/security-detections-response` (#202847) ## Summary This PR aims at relocating some of the Kibana modules (plugins and packages) into a new folder structure, according to the _Sustainable Kibana Architecture_ initiative. > [!IMPORTANT] > * We kindly ask you to: > * Manually fix the errors in the error section below (if there are any). > * Search for the `packages[\/\\]` and `plugins[\/\\]` patterns in the source code (Babel and Eslint config files), and update them appropriately. > * Manually review `.buildkite/scripts/pipelines/pull_request/pipeline.ts` to ensure that any CI pipeline customizations continue to be correctly applied after the changed path names > * Review all of the updated files, specially the `.ts` and `.js` files listed in the sections below, as some of them contain relative paths that have been updated. > * Think of potential impact of the move, including tooling and configuration files that can be pointing to the relocated modules. E.g.: > * customised eslint rules > * docs pointing to source code > [!NOTE] > * This PR has been auto-generated. > * Any manual contributions will be lost if the 'relocate' script is re-run. > * Try to obtain the missing reviews / approvals before applying manual fixes, and/or keep your changes in a .patch / git stash. > * Please use [#sustainable_kibana_architecture](https://elastic.slack.com/archives/C07TCKTA22E) Slack channel for feedback. Are you trying to rebase this PR to solve merge conflicts? Please follow the steps describe [here](https://elastic.slack.com/archives/C07TCKTA22E/p1734019532879269?thread_ts=1734019339.935419&cid=C07TCKTA22E). #### 1 packages(s) are going to be relocated: | Id | Target folder | | -- | ------------- | | `@kbn/rule-data-utils` | `src/platform/packages/shared/kbn-rule-data-utils` |
Updated references ``` ./package.json ./packages/kbn-repo-packages/package-map.json ./packages/kbn-ts-projects/config-paths.json ./src/platform/packages/shared/kbn-rule-data-utils/jest.config.js ./src/platform/plugins/shared/discover/tsconfig.type_check.json ./tsconfig.base.json ./tsconfig.base.type_check.json ./tsconfig.refs.json ./x-pack/examples/triggers_actions_ui_example/tsconfig.type_check.json ./x-pack/packages/observability/alert_details/tsconfig.type_check.json ./x-pack/packages/observability/alerting_test_data/tsconfig.type_check.json ./x-pack/platform/plugins/private/monitoring/tsconfig.type_check.json ./x-pack/plugins/alerting/tsconfig.type_check.json ./x-pack/plugins/cases/tsconfig.type_check.json ./x-pack/plugins/ml/tsconfig.type_check.json ./x-pack/plugins/observability_solution/apm/tsconfig.type_check.json ./x-pack/plugins/observability_solution/infra/tsconfig.type_check.json ./x-pack/plugins/observability_solution/investigate_app/tsconfig.type_check.json ./x-pack/plugins/observability_solution/observability/tsconfig.type_check.json ./x-pack/plugins/observability_solution/observability_logs_explorer/tsconfig.type_check.json ./x-pack/plugins/observability_solution/observability_shared/tsconfig.type_check.json ./x-pack/plugins/observability_solution/slo/tsconfig.type_check.json ./x-pack/plugins/observability_solution/synthetics/tsconfig.type_check.json ./x-pack/plugins/observability_solution/uptime/tsconfig.type_check.json ./x-pack/plugins/rule_registry/tsconfig.type_check.json ./x-pack/plugins/stack_alerts/tsconfig.type_check.json ./x-pack/plugins/transform/tsconfig.type_check.json ./x-pack/plugins/triggers_actions_ui/tsconfig.type_check.json ./x-pack/solutions/security/plugins/timelines/tsconfig.type_check.json ./x-pack/test/alerting_api_integration/common/plugins/alerts/tsconfig.type_check.json ./x-pack/test/security_solution_api_integration/tsconfig.type_check.json ./x-pack/test/tsconfig.type_check.json ./x-pack/test_serverless/tsconfig.type_check.json ./yarn.lock .github/CODEOWNERS ```
Updated relative paths ``` src/platform/packages/shared/kbn-rule-data-utils/jest.config.js:12 src/platform/packages/shared/kbn-rule-data-utils/tsconfig.json:2 src/platform/packages/shared/kbn-rule-data-utils/tsconfig.type_check.json:2 ```
Co-authored-by: Marshall Main <55718608+marshallmain@users.noreply.github.com> (cherry picked from commit e6a07e63829e116c8e809a3923b7b0fe239e1318) # Conflicts: # .github/CODEOWNERS --- .buildkite/scripts/pipelines/pull_request/pipeline.ts | 2 +- .github/CODEOWNERS | 2 +- package.json | 2 +- .../platform/packages/shared}/kbn-rule-data-utils/index.ts | 0 .../packages/shared}/kbn-rule-data-utils/jest.config.js | 4 ++-- .../packages/shared}/kbn-rule-data-utils/kibana.jsonc | 0 .../packages/shared}/kbn-rule-data-utils/package.json | 0 .../shared}/kbn-rule-data-utils/src/alerts_as_data_cases.ts | 0 .../kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts | 0 .../shared}/kbn-rule-data-utils/src/alerts_as_data_rbac.ts | 0 .../kbn-rule-data-utils/src/alerts_as_data_severity.ts | 0 .../shared}/kbn-rule-data-utils/src/alerts_as_data_status.ts | 0 .../shared}/kbn-rule-data-utils/src/default_alerts_as_data.ts | 0 .../shared}/kbn-rule-data-utils/src/legacy_alerts_as_data.ts | 0 .../kbn-rule-data-utils/src/routes/stack_rule_paths.ts | 0 .../shared}/kbn-rule-data-utils/src/rule_types/index.ts | 0 .../shared}/kbn-rule-data-utils/src/rule_types/o11y_rules.ts | 0 .../shared}/kbn-rule-data-utils/src/rule_types/stack_rules.ts | 0 .../shared}/kbn-rule-data-utils/src/technical_field_names.ts | 0 .../packages/shared}/kbn-rule-data-utils/tsconfig.json | 2 +- tsconfig.base.json | 4 ++-- yarn.lock | 2 +- 22 files changed, 9 insertions(+), 9 deletions(-) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/index.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/jest.config.js (83%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/kibana.jsonc (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/package.json (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/alerts_as_data_cases.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/alerts_as_data_rbac.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/alerts_as_data_severity.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/alerts_as_data_status.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/default_alerts_as_data.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/legacy_alerts_as_data.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/routes/stack_rule_paths.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/rule_types/index.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/rule_types/o11y_rules.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/rule_types/stack_rules.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/src/technical_field_names.ts (100%) rename {packages => src/platform/packages/shared}/kbn-rule-data-utils/tsconfig.json (82%) diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index e5152c174b236..403dbe53350f8 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -302,7 +302,7 @@ const getPipeline = (filename: string, removeSteps = true) => { /^packages\/kbn-grouping/, /^packages\/kbn-resizable-layout/, /^packages\/kbn-rison/, - /^packages\/kbn-rule-data-utils/, + /^src\/platform\/packages\/shared\/kbn-rule-data-utils/, /^packages\/kbn-safer-lodash-set/, /^packages\/kbn-search-types/, /^packages\/kbn-securitysolution-.*/, diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dd93c3adcb9d3..988ef63ca4877 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -758,7 +758,7 @@ packages/kbn-router-to-openapispec @elastic/kibana-core packages/kbn-router-utils @elastic/obs-ux-logs-team examples/routing_example @elastic/kibana-core packages/kbn-rrule @elastic/response-ops -packages/kbn-rule-data-utils @elastic/security-detections-response @elastic/response-ops @elastic/obs-ux-management-team +src/platform/packages/shared/kbn-rule-data-utils @elastic/security-detections-response @elastic/response-ops @elastic/obs-ux-management-team x-pack/plugins/rule_registry @elastic/response-ops @elastic/obs-ux-management-team x-pack/platform/plugins/private/runtime_fields @elastic/kibana-management packages/kbn-safer-lodash-set @elastic/kibana-security diff --git a/package.json b/package.json index da1189c509e8e..12e17e0d91001 100644 --- a/package.json +++ b/package.json @@ -770,7 +770,7 @@ "@kbn/router-utils": "link:packages/kbn-router-utils", "@kbn/routing-example-plugin": "link:examples/routing_example", "@kbn/rrule": "link:packages/kbn-rrule", - "@kbn/rule-data-utils": "link:packages/kbn-rule-data-utils", + "@kbn/rule-data-utils": "link:src/platform/packages/shared/kbn-rule-data-utils", "@kbn/rule-registry-plugin": "link:x-pack/plugins/rule_registry", "@kbn/runtime-fields-plugin": "link:x-pack/platform/plugins/private/runtime_fields", "@kbn/safer-lodash-set": "link:packages/kbn-safer-lodash-set", diff --git a/packages/kbn-rule-data-utils/index.ts b/src/platform/packages/shared/kbn-rule-data-utils/index.ts similarity index 100% rename from packages/kbn-rule-data-utils/index.ts rename to src/platform/packages/shared/kbn-rule-data-utils/index.ts diff --git a/packages/kbn-rule-data-utils/jest.config.js b/src/platform/packages/shared/kbn-rule-data-utils/jest.config.js similarity index 83% rename from packages/kbn-rule-data-utils/jest.config.js rename to src/platform/packages/shared/kbn-rule-data-utils/jest.config.js index fd0feabd9f0ad..c8cb6a4bbec63 100644 --- a/packages/kbn-rule-data-utils/jest.config.js +++ b/src/platform/packages/shared/kbn-rule-data-utils/jest.config.js @@ -9,6 +9,6 @@ module.exports = { preset: '@kbn/test', - rootDir: '../..', - roots: ['/packages/kbn-rule-data-utils'], + rootDir: '../../../../..', + roots: ['/src/platform/packages/shared/kbn-rule-data-utils'], }; diff --git a/packages/kbn-rule-data-utils/kibana.jsonc b/src/platform/packages/shared/kbn-rule-data-utils/kibana.jsonc similarity index 100% rename from packages/kbn-rule-data-utils/kibana.jsonc rename to src/platform/packages/shared/kbn-rule-data-utils/kibana.jsonc diff --git a/packages/kbn-rule-data-utils/package.json b/src/platform/packages/shared/kbn-rule-data-utils/package.json similarity index 100% rename from packages/kbn-rule-data-utils/package.json rename to src/platform/packages/shared/kbn-rule-data-utils/package.json diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_cases.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_cases.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/alerts_as_data_cases.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_cases.ts diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_rbac.test.ts diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_rbac.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_rbac.ts diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_severity.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_severity.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/alerts_as_data_severity.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_severity.ts diff --git a/packages/kbn-rule-data-utils/src/alerts_as_data_status.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_status.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/alerts_as_data_status.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/alerts_as_data_status.ts diff --git a/packages/kbn-rule-data-utils/src/default_alerts_as_data.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/default_alerts_as_data.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/default_alerts_as_data.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/default_alerts_as_data.ts diff --git a/packages/kbn-rule-data-utils/src/legacy_alerts_as_data.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/legacy_alerts_as_data.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/legacy_alerts_as_data.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/legacy_alerts_as_data.ts diff --git a/packages/kbn-rule-data-utils/src/routes/stack_rule_paths.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/routes/stack_rule_paths.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/routes/stack_rule_paths.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/routes/stack_rule_paths.ts diff --git a/packages/kbn-rule-data-utils/src/rule_types/index.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/index.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/rule_types/index.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/index.ts diff --git a/packages/kbn-rule-data-utils/src/rule_types/o11y_rules.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/o11y_rules.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/rule_types/o11y_rules.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/o11y_rules.ts diff --git a/packages/kbn-rule-data-utils/src/rule_types/stack_rules.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/stack_rules.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/rule_types/stack_rules.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/rule_types/stack_rules.ts diff --git a/packages/kbn-rule-data-utils/src/technical_field_names.ts b/src/platform/packages/shared/kbn-rule-data-utils/src/technical_field_names.ts similarity index 100% rename from packages/kbn-rule-data-utils/src/technical_field_names.ts rename to src/platform/packages/shared/kbn-rule-data-utils/src/technical_field_names.ts diff --git a/packages/kbn-rule-data-utils/tsconfig.json b/src/platform/packages/shared/kbn-rule-data-utils/tsconfig.json similarity index 82% rename from packages/kbn-rule-data-utils/tsconfig.json rename to src/platform/packages/shared/kbn-rule-data-utils/tsconfig.json index 77352c4f44209..536c1110ab3e3 100644 --- a/packages/kbn-rule-data-utils/tsconfig.json +++ b/src/platform/packages/shared/kbn-rule-data-utils/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "types": [ diff --git a/tsconfig.base.json b/tsconfig.base.json index c43eb12794e5d..73e7098c444de 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1510,8 +1510,8 @@ "@kbn/routing-example-plugin/*": ["examples/routing_example/*"], "@kbn/rrule": ["packages/kbn-rrule"], "@kbn/rrule/*": ["packages/kbn-rrule/*"], - "@kbn/rule-data-utils": ["packages/kbn-rule-data-utils"], - "@kbn/rule-data-utils/*": ["packages/kbn-rule-data-utils/*"], + "@kbn/rule-data-utils": ["src/platform/packages/shared/kbn-rule-data-utils"], + "@kbn/rule-data-utils/*": ["src/platform/packages/shared/kbn-rule-data-utils/*"], "@kbn/rule-registry-plugin": ["x-pack/plugins/rule_registry"], "@kbn/rule-registry-plugin/*": ["x-pack/plugins/rule_registry/*"], "@kbn/runtime-fields-plugin": ["x-pack/platform/plugins/private/runtime_fields"], diff --git a/yarn.lock b/yarn.lock index 2aaff10774d3c..9755e42ba06df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6827,7 +6827,7 @@ version "0.0.0" uid "" -"@kbn/rule-data-utils@link:packages/kbn-rule-data-utils": +"@kbn/rule-data-utils@link:src/platform/packages/shared/kbn-rule-data-utils": version "0.0.0" uid ""