-
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
Read coreApp assets directly from package #144492
Read coreApp assets directly from package #144492
Conversation
…ssets, export post-build paths to assets
… page to read assets from new location
ASSETS = glob(["assets/**/*"]) | ||
|
||
filegroup( | ||
name = "assets", | ||
srcs = ASSETS, | ||
) | ||
|
||
NPM_MODULE_EXTRA_FILES = [ | ||
"package.json", | ||
":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.
So, what does that do exactly?
But I think I spotted the problem:
This PR moved the assets from {package}/src/assets
to {package}/assets
. However you did not change the path in the route registered to serve them:
kibana/packages/core/apps/core-apps-server-internal/src/core_app.ts
Lines 205 to 206 in 0ba81e1
private registerStaticDirs(core: InternalCoreSetup | InternalCorePreboot) { | |
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets')); |
Changing the Path.resolve(__dirname, './assets')
to target the correct folder should hopefully do the trick.
core.http.registerStaticDir('/ui/{path*}', Path.resolve(__dirname, './assets')); | ||
core.http.registerStaticDir( | ||
'/ui/{path*}', | ||
fromRoot('node_modules/@kbn/core-apps-server-internal/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.
We need to load these assets from their location post-build.
await run(Tasks.CreateEmptyDirsAndFiles); | ||
await run(Tasks.CreateReadme); | ||
await run(Tasks.BuildBazelPackages); | ||
await run(Tasks.ReplaceFavicon); |
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.
The build process expects an empty directory into which to replace the distributable versions of favicons with their source. At least, that's how I understand the flow here.
@@ -33,7 +33,6 @@ export const CopySource: Task = { | |||
'!src/**/mocks.{js,ts}', | |||
'!src/cli*/dev.js', | |||
'!src/plugins/telemetry/schema/**', | |||
'!src/core/server/core_app/assets/favicons/favicon.distribution.{ico,png,svg}', |
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 files moved and the path doesn't exist anymore.
@@ -6,7 +6,7 @@ | |||
*/ | |||
|
|||
export * from './api'; | |||
import '@kbn/core/server/core_app/assets/legacy_light_theme.css'; | |||
import '@kbn/core-apps-server-internal/assets/legacy_light_theme.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.
Updates path to 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.
mind if we add the ci:build-canvas-shareable-runtime
label to test this?
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.
I don't mind. I've added the label, and kicked off another run.
@jbudz FMI, what does that label setup and run given that the label needs to be added explicitly? The only reference I can find is here and I'm interpreting that to mean we don't build the canvas shareable runtime by default. Is that correct?
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.
@jbudz after adding the flag, the ci run fails on "canvas shareable runtime" for "total size" is 192390 over the configured limit of 8200000". commit:9471f5c
The only thing this PR does in the canvas shareable_runtime module is to update the location from which the legacy_light_theme
stylesheet is read.
From what I can see, the theme itself is 100Kb and the minimized version is sitting at 79Kb, and don't appear to have changed in size from what's in main right now.
Is there anything I need to do here? Should we be updating the limit?
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. The runtime isn't built in PR's anymore by default because it adds 3-4 minutes to build times and doesn't have any tests. The webpack config doesn't change too often so we were okay with the tradeoff.
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.
Limit looks like it's something for ops to triage, that's about expected.
Pinging @elastic/kibana-core (Team:Core) |
@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.
Code only review - import change LGTM 👍
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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
Handles the follow-up work from #144075
Part of #134112
In #144075, we had to leave duplicates of the assets declared in
coreApp
withinsrc/core/server/core_app
because these assets were imported or referenced directly elsewhere.This PR removes these duplicates and exposes the assets directly from the package.
References updated:
The changes involved:
assets
folder out of the packagesrc
folder with corresponding updates to the Bazel build filedev
build scripts, including moving theReplaceFavicon
build task to after empty directories are created (thanks @mistic!).