-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
IDM: Migrate core server-side core_app to package #144075
IDM: Migrate core server-side core_app to package #144075
Conversation
…config to include more file types for the assets
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.
As mentioned in the PR description, I took the best guess at handling the assets, while leaving a copy of them in src/core/server/core_app
.
SOURCE_FILES = glob( | ||
[ | ||
"**/*.ts", | ||
"src/**/*.css", |
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.
On a whim, I took the same approach as previously when handling code that includes stylesheets.
@@ -6,4 +6,4 @@ | |||
* Side Public License, v 1. | |||
*/ | |||
|
|||
export { CoreApp } from './core_app'; | |||
export { CoreAppsService } from './src'; |
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.
Changed the service class name to keep consistent with the browser-side service class counterpart.
import { fromRoot } from '@kbn/utils'; | ||
import UiSharedDepsNpm from '@kbn/ui-shared-deps-npm'; | ||
import * as UiSharedDepsSrc from '@kbn/ui-shared-deps-src'; | ||
import { distDir as UiSharedDepsSrcDistDir } from '@kbn/ui-shared-deps-src'; |
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.
import * as ...
doesn't work in packages. I took the approach of renaming the specific dependency.
…s suplicated in package
…ore-apps-server-internal
@elasticmachine merge upstream |
|
||
export { CoreAppsService } from './src'; | ||
export { | ||
registerBundleRoutes, |
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.
These are needed for the integration tests in src/core/server/integration_tests
.
We can decide as a team how to handle the integration tests during the migration cleanup phase. The pending tooling changes should give us a bit more freedom in package structure and inteneral dependencies.
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.
NIT: In similar cases for other packages, I added a comment to 'separate' the 'real' imports from the integration-test-only imports.
E.g:
kibana/packages/core/saved-objects/core-saved-objects-server-internal/index.ts
Lines 17 to 22 in 92ca42f
// only used by integration tests | |
export { registerDeleteUnknownTypesRoute } from './src/routes/deprecations'; | |
export { registerLegacyExportRoute } from './src/routes/legacy_import_export/export'; | |
export { registerLegacyImportRoute } from './src/routes/legacy_import_export/import'; | |
export { registerBulkCreateRoute } from './src/routes/bulk_create'; | |
export { registerBulkGetRoute } from './src/routes/bulk_get'; |
SOURCE_FILES = glob( | ||
[ | ||
"**/*.ts", | ||
"src/**/*.css", |
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.
@elastic/kibana-operations is there a trick to serving the assets directly from the package so that we don't need to keep them in src/core
?
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.
WDYM by 'serving' here exactly?
To my knowledge, there are two usages of these files:
The correct one:
kibana/src/core/server/core_app/core_app.ts
Line 206 in 8176ac7
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets')); |
which should work out of the box when the assets are moved in the package (right?)
And that scss import, that I didn't even knew about:
import '@kbn/core/server/core_app/assets/legacy_light_theme.css'; |
You're referring to the second one here, right?
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.
yes, I'm referring to the second one.
export type { | ||
InternalCoreAppsServiceRequestHandlerContext, | ||
InternalCoreAppsServiceRouter, | ||
} from './src'; |
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.
@elastic/kibana-operations how would we expose the assets from this package?
let coreApp: CoreApp; | ||
let internalCorePreboot: ReturnType<typeof coreMock.createInternalPreboot>; | ||
let coreApp: CoreAppsService; | ||
let internalCorePreboot: ReturnType<typeof coreInternalLifecycleMock.createInternalPreboot>; |
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.
As of #141891, core's internal lifecycles are exposed in a package, so we can use those directly.
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.
Adds more self review comments
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
remove location from dev script
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.
SOURCE_FILES = glob( | ||
[ | ||
"**/*.ts", | ||
"src/**/*.css", |
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.
WDYM by 'serving' here exactly?
To my knowledge, there are two usages of these files:
The correct one:
kibana/src/core/server/core_app/core_app.ts
Line 206 in 8176ac7
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets')); |
which should work out of the box when the assets are moved in the package (right?)
And that scss import, that I didn't even knew about:
import '@kbn/core/server/core_app/assets/legacy_light_theme.css'; |
You're referring to the second one here, right?
|
||
export { CoreAppsService } from './src'; | ||
export { | ||
registerBundleRoutes, |
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.
NIT: In similar cases for other packages, I added a comment to 'separate' the 'real' imports from the integration-test-only imports.
E.g:
kibana/packages/core/saved-objects/core-saved-objects-server-internal/index.ts
Lines 17 to 22 in 92ca42f
// only used by integration tests | |
export { registerDeleteUnknownTypesRoute } from './src/routes/deprecations'; | |
export { registerLegacyExportRoute } from './src/routes/legacy_import_export/export'; | |
export { registerLegacyImportRoute } from './src/routes/legacy_import_export/import'; | |
export { registerBulkCreateRoute } from './src/routes/bulk_create'; | |
export { registerBulkGetRoute } from './src/routes/bulk_get'; |
|
||
Apache License | ||
Version 2.0, January 2004 | ||
http://www.apache.org/licenses/ | ||
|
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.
(commenting here because GH doesn't allow me to do it on font/binary files): related to my first comment: What's the issue with the assets exactly? Are we forced to duplicate all of them (meaning keeping them all under src/core/server/core_app/assets
too), or is the issue just about the scss import of the src/core/server/core_app/assets/legacy_light_theme.css
file from
import '@kbn/core/server/core_app/assets/legacy_light_theme.css'; |
?
Because if that's the latest, I'd rather only keep the strict subset of required files in src/core/server/core_app/assets
instead of duplicating them all.
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.
Agreed, the only asset we need to keep for now is legacy_light_theme.css
. We can follow up with changing the export at a later stage when we're forced to touch other teams' code.
Update, it turns out we need the favicons too.
Follow up WIP in #144375
@@ -13,15 +13,15 @@ import type { UiSettingsRequestHandlerContext } from '@kbn/core-ui-settings-serv | |||
* Request handler context used by core's coreApp routes. | |||
* @internal | |||
*/ | |||
export interface InternalCoreAppRequestHandlerContext extends RequestHandlerContextBase { | |||
export interface InternalCoreAppsServiceRequestHandlerContext extends RequestHandlerContextBase { |
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.
This was internal, so the change wasn't strictly necessary, but 👍 for consistency.
On further investigation, the build scripts use the favicons in For now, I'd prefer to keep the number of code-owners' reviews small while we finish our first pass at migrating core services to packages. we can clean all this up during the cleanup phase once we've had a chance to huddle with the @elastic/kibana-operations team. I've began to attempt to change this in #144375 |
9f05131
to
7afc72b
Compare
@elasticmachine merge upstream |
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 given we have a follow-up created for my questions
@elasticmachine merge upstream |
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.
Changes under operations team code owners LGTM
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Public APIs missing comments
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
fix #135865
Create package:
@kbn/core-apps-server-internal
Notes:
src/core/server/core_app
contains assets included in the bundled routes. Following how I understood the inner workings of bundling and serving these assets, I tried moving the files to the package and updating the build scripts to account for the new paths. I also had to update the import path for thelegacy_light_theme.css
in canvas. That didn't work, so I had to duplicate the files and leave a subset of theassets
in src/core.