Use runtime publicPath for KP plugin bundles#64226
Merged
joshdover merged 6 commits intoelastic:masterfrom Apr 23, 2020
Merged
Conversation
spalger
reviewed
Apr 22, 2020
Contributor
spalger
left a comment
There was a problem hiding this comment.
Verified that this works as intended, super excited to get rid of the request-time public path replacements .
spalger
reviewed
Apr 22, 2020
Contributor
|
Pinging @elastic/kibana-platform (Team:Platform) |
17 tasks
Contributor
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
joshdover
added a commit
to joshdover/kibana
that referenced
this pull request
Apr 23, 2020
joshdover
added a commit
that referenced
this pull request
Apr 23, 2020
spalger
added a commit
to mshustov/kibana
that referenced
this pull request
Apr 28, 2020
spalger
added a commit
that referenced
this pull request
Apr 29, 2020
* convert into TS * load plugin scripts in html body * use buildNum as a unique Id for cache busting * add tests for caching * fix tests * remove the last TODO. url should be inlined with assetss server * this logic handled by publicPathMap on the client * cache kbn-shared-deps as well * attempt to fix karma tests * always run file through replace stream * place buildHash at begining of path, include all static files * update bundles_route tests to inject buildNum everywhere * fix karma config to point to right prefix * use isDist naming throughout * explain magic number with variables * restore replacePublicPath option from #64226 * replace one more instance of replacePublicPath * use promisify instead of bluebird + non-null assertions * remove one more magic number Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
spalger
added a commit
to spalger/kibana
that referenced
this pull request
Apr 29, 2020
* convert into TS * load plugin scripts in html body * use buildNum as a unique Id for cache busting * add tests for caching * fix tests * remove the last TODO. url should be inlined with assetss server * this logic handled by publicPathMap on the client * cache kbn-shared-deps as well * attempt to fix karma tests * always run file through replace stream * place buildHash at begining of path, include all static files * update bundles_route tests to inject buildNum everywhere * fix karma config to point to right prefix * use isDist naming throughout * explain magic number with variables * restore replacePublicPath option from elastic#64226 * replace one more instance of replacePublicPath * use promisify instead of bluebird + non-null assertions * remove one more magic number Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related to #62263
This removes the processing we do on bundles to inject the base path into bundles at runtime. Instead, bundles built by the
@kbn/optimizerpackage will now look for a public path defined on a key in a global object:window.__kbnPublicPath__. These keys are populated by the bootstrap.js script and map each entry point id to the directory containing all of the outputs for that webpack build.This unblocks efforts to use the brotli compression algorithm instead of gzip. This is necessary because brotli compression is slow, so we must do it at build time. This is only possible if we do not need to do any processing before serving the file to the client.
Unfortunately, this PR is mostly a "works by coincidence" situation, meaning that the integration between
@kbn/optimizerand the bundle serving and bootstrapping logic must align in order for this work. There's not a great way to test this directly, but it is covered by existing e2e test coverage.I would like to create unit tests for the
ui_render_mixinandbootstrap.jsscript, however it seems impractical to do so until these are migrated to the Kibana Platform.Checklist
Delete any items that are not applicable to this PR.
For maintainers