- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.5k
 
Remove legacy plugins support #77599
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
Remove legacy plugins support #77599
Conversation
…legacy-plugins-support
| 
           @pgayvallet I think we can also delete   | 
    
…legacy-plugins-support
…legacy-plugins-support
…legacy-plugins-support
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.
Code & local test LGTM
| export function wrapEsError(err: any, statusCodeToMessageMap: Record<string, any> = {}) { | ||
| const { statusCode, response } = err; | ||
| 
               | 
          ||
| const { | ||
| error: { | ||
| root_cause = [], // eslint-disable-line @typescript-eslint/naming-convention | ||
| caused_by = {}, // eslint-disable-line @typescript-eslint/naming-convention | ||
| } = {}, | ||
| } = JSON.parse(response); | 
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.
Thanks for the heads up!
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.
Looks good overall. There are still a few things to remove, I'm going to add them to #56205 to do in the follow-ups.
| pluginMap: readdirSync(resolve(__dirname, 'x-pack/legacy/plugins')).reduce( | ||
| (acc, name) => { | ||
| if (!name.startsWith('_')) { | ||
| acc[name] = `x-pack/legacy/plugins/${name}`; | ||
| } | ||
| return acc; | ||
| }, | ||
| {} | ||
| ), | ||
| pluginMap: {}, | 
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.
Doesn't it mean that we can remove the eslint-import-resolver-kibana plugin at all?
| export type KibanaConfig = LegacyKibanaServer.KibanaConfig; | ||
| export type Request = LegacyKibanaServer.Request; | ||
| export type ResponseToolkit = LegacyKibanaServer.ResponseToolkit; | ||
| export type Server = LegacyKibanaServer.Server; | 
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.
There shouldn't be any plugin code relying on the Hapi types. Created #77997
| legacyInternals = new LegacyInternals(uiExports, config, server); | ||
| legacyInternals = new LegacyInternals(); | 
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.
Hm...IIRC it's used to read injectedVars only. 
| vars: vars ?? (await this.legacyInternals!.getVars('core', request)), | 
As we don't have any plugins to inject vars, we can delete this API. Did I miss anything?
Can be done in a follow-up. Could you create an issue, please?
| plugin: DiscoveredPlugin; | ||
| config?: Record<string, unknown>; | ||
| }>; | ||
| legacyMetadata: { | 
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.
It seems we use legacyMetadata to read uiSettings solely. Can we remove the other fields?
        
          
                src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/exports_string/index.js
          
            Show resolved
            Hide resolved
        
      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.
Ingest Manager changes LGTM
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.
SIEM changes LGTM, Thank you @pgayvallet 👍
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.
APM changes look good.
| import { ANOMALY_SEVERITY } from '../../ml/common'; | ||
| 
               | 
          ||
| import { EuiTheme } from '../../../legacy/common/eui_styled_components'; | ||
| import { EuiTheme } from '../../xpack_legacy/common'; | 
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.
We can actually import this from the observability plugin but it's in public there so we'll have to move that around in a separate PR.
…legacy-plugins-support
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.
Is xpack_legacy a folder you want to remove? Should we be planning to move off of that or is it fine to leave those paths like that forever?
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
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
…legacy-plugins-support
          
 We are not planning to delete this plugin short term, even if at some point, we probably will (8.0 hopefully) Regarding what I had to move there in this PR (the   | 
    
* remove ALL the things. * adapt some types and tests * restore ensureValidConfiguration * fix legacy service tests * adapt uiRender mixin * remove legacy types * update generated doc * restore legacy plugin schema * update generated doc * remove remaining code of x-pack/legacy * adapt imports due to merge * cleanup CODEOWNERS * cleanup gitignore & i18nrc * cleanup tsconfig.json * remove unused i18n keys * add back `"legacy/plugins/**/*",` to tsconfig until legacy space plugin is deleted * fix create_jest_config * remove references from eslintrc * more eslint cleanup * remove `x-pack/index.js` * fix xpack gulp scripts * fix bug with default + named imports from boom * remove rules from eslintrc * remove LegacyInternals * review comments * update generated doc * cleanup legacy metadatas * revert changes to eslintrc * update generated doc # Conflicts: # .github/CODEOWNERS # x-pack/.i18nrc.json # x-pack/dev-tools/jest/create_jest_config.js # x-pack/legacy/plugins/xpack_main/index.js # x-pack/legacy/server/lib/constants/index.ts # x-pack/legacy/server/lib/key_case_converter.js # x-pack/legacy/server/lib/watch_status_and_license_to_initialize.js
          💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
 async chunks size
 page load bundle size
 distributable file count
 History
 To update your PR or re-run it, just comment with:  | 
    
* remove ALL the things. * adapt some types and tests * restore ensureValidConfiguration * fix legacy service tests * adapt uiRender mixin * remove legacy types * update generated doc * restore legacy plugin schema * update generated doc * remove remaining code of x-pack/legacy * adapt imports due to merge * cleanup CODEOWNERS * cleanup gitignore & i18nrc * cleanup tsconfig.json * remove unused i18n keys * add back `"legacy/plugins/**/*",` to tsconfig until legacy space plugin is deleted * fix create_jest_config * remove references from eslintrc * more eslint cleanup * remove `x-pack/index.js` * fix xpack gulp scripts * fix bug with default + named imports from boom * remove rules from eslintrc * remove LegacyInternals * review comments * update generated doc * cleanup legacy metadatas * revert changes to eslintrc * update generated doc # Conflicts: # .github/CODEOWNERS # x-pack/.i18nrc.json # x-pack/dev-tools/jest/create_jest_config.js # x-pack/legacy/plugins/xpack_main/index.js # x-pack/legacy/server/lib/constants/index.ts # x-pack/legacy/server/lib/key_case_converter.js # x-pack/legacy/server/lib/watch_status_and_license_to_initialize.js
* master: (31 commits) skip tests for old pacakge (elastic#78194) [Ingest Pipelines] Add url generator for ingest pipelines app (elastic#77872) [Lens] Rename "telemetry" to "stats" (elastic#78125) [CSM] Url search (elastic#77516) [Drilldowns] Config to disable URL Drilldown (elastic#77887) [Lens] Combined histogram/range aggregation for numbers (elastic#76121) Remove legacy plugins support (elastic#77599) 'Auto' interval must be correctly calculated for natural numbers (elastic#77995) [CSM] fix ingest data retry order messed up (elastic#78163) Add response status helpers (elastic#78006) Bump react-beautiful-dnd (elastic#78028) [Security Solution][Detection Engine] Bubbles up more error messages from ES queries to the UI (elastic#78004) Index pattern - refactor constructor (elastic#77791) Add `xpack.security.sameSiteCookies` to docker allow list (elastic#78192) Remove [key: string]: any; from IIndexPattern (elastic#77968) Remove requirement for manage_index_templates privilege for Index Management (elastic#77377) [Ingest Manager] Agent bulk actions UI (elastic#77690) [Metrics UI] Add inventory view timeline (elastic#77804) Reporting/Docs: Updates for setting to enable CSV Download (elastic#78101) Update to latest rum-react (elastic#78193) ...
Summary
Fix #71927
Remove legacy plugin discovery and support from the legacy platform.
xpackMainpluginChecklist
For maintainers
Release Note
The legacy plugin system and the legacy plugin API have been removed. It is no longer possible to use third parties legacy Kibana plugins. Legacy plugin owners should migrate their plugins to the Kibana Platform plugin API