kibana/scripts
Spencer 4e8ab56497
build immutable bundles for new platform plugins (#53976)
* build immutable bundles for new platform plugins

* only inspect workers if configured to do so

* [navigation] use an index.scss file

* add yarn.lock symlink

* set pluginScanDirs in test so fixtures stay consistent

* cleanup helpers a little

* fix type error

* support KBN_OPTIMIZER_MAX_WORKERS for limiting workers via env

* test support for KBN_OPTIMIZER_MAX_WORKERS

* expand the available memory for workers when only running one or two

* add docs about KBN_OPTIMIZER_MAX_WORKERS environment variable

* fix README link

* update kbn/pm dist

* implement bundle caching/reuse

* update kbn/pm dist

* don't check for cache if --no-cache is passed

* update renovate config

* standardize on index.scss, move console styles over

* add support for --no-cache to cli

* include worker config vars in optimizer version

* ignore concatenated modules

* update integration test

* add safari to browserslist to avoid user-agent warnings in dev

* update docs, clean up optimizer message/misc naming

* always handle initialized messages, don't ignore states that are attached to specific events

* reword caching docs, add environment var to disable caching

* tweak logging and don't use optimizer.useBundleCache as that's disabled in dev

* handle change notifications

* batch changes for 1 second

* rename CompilerState type to CompilerMsg

* getChanges() no longer needs to assign changes to dirs

* remove unused deps

* split up run_worker.ts and share cacheKey generation logic

* add a couple docs

* update tests and remove unused imports

* specify files when creating bundle cache key

* remove one more unused import

* match existing dev cli output more closely

* update kbn/pm dist

* set KBN_NP_PLUGINS_BUILT to avoid warning in CI

* avoid extending global window type

* add note to keep pluginScanDirs in sync

* pass browserslistEnv in workerConfig so it is used for cache key

* load commons.bundle.js in parallel too

* emit initialized+success states if all bundles are cached

* load bootstraps as quickly as possible

* skip flaky suite

* bump

* update jest snapshots

* remove hashing from cache key generation

* remove unnecessary non-null assertion

* improve docs and break up Optimizer#run()

* remove unused import

* refactor kbn/optimizer to break up observable logic, implement more helpful cache invalidation logic with logging

* fix tests

* add initializing phase

* avoid rxjs observable constructor

* remove unnecessary rxjs helper, add tests for bundle cache

* update consumers of optimizer

* update readme with new call style

* replace "new platform" with "kibana platform"

* fix a couple more renames

* add support for several plain-text file formats

* fix naming of OptimizerMsg => OptimizerUpdate, use "store" naming too

* one more OptimizerMsg update

* ensure bundles are not cached when cache config is false

* test for initializing states and bundle cache events

* remove unnecessary timeout change

* Remove unnecessary helpers

* Add tests for BundleCache class

* Add tests for Bundle class

* test summarizeEvent$

* missing paths are no longer listed in mtimes map

* add tests for optimizer/cache_keys

* Add some extra docs

* Remove labeled loop

* add integration test for kbn-optimizer watcher components

* querystring-browser removed

* tweak logging a smidge, improve info and final message

* remove unused imports

* remove duplication of getModuleCount() method

* move type annotation that validates things

* clear up the build completion message

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-12 19:42:42 -07:00
..
backport.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
build.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
build_kibana_platform_plugins.js build immutable bundles for new platform plugins (#53976) 2020-02-12 19:42:42 -07:00
build_renovate_config.js Implement renovate config generator (#38369) 2019-06-07 13:30:59 -07:00
build_sass.js [dev] share sass build with script (#34323) 2019-04-02 11:53:48 -07:00
check_core_api_changes.js Generate core API docs from TSDoc comments (#32148) 2019-04-03 12:26:00 +02:00
check_file_casing.js Change check_file_casing to require setup_node_env (#19499) 2018-05-29 11:48:43 -04:00
check_licenses.js [dev/license_checker][dev/npm] reactor, ts-ify, de-grunt (#37807) 2019-06-06 10:16:19 -07:00
check_lockfile_symlinks.js Add lockfile symlinks (#55440) 2020-01-27 11:38:20 -05:00
check_ts_projects.js [ts] add script to verify that all ts is in a project (#32727) 2019-03-08 13:51:55 -08:00
docs.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
es.js autofix all violations 2019-12-13 23:17:13 -07:00
es_archiver.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
eslint.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
functional_test_runner.js [FTR] Refactor FTR to live under KBN-TEST (#42547) 2019-08-06 15:35:16 -06:00
functional_tests.js Code coverage setup on CI (#49003) 2020-01-08 21:08:48 +01:00
functional_tests_server.js autofix all violations 2019-12-13 23:17:13 -07:00
generate_plugin.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
i18n_check.js Integrate main i18n tool into build pipeline (#22254) 2018-08-29 11:55:34 +03:00
i18n_extract.js Add zh-CN.json translations and respective compatibility checks via i18n tools (#30378) 2019-02-11 14:39:59 +01:00
i18n_integrate.js Implement a build tool for locale files integration (#19826) 2018-12-22 13:06:40 +03:00
jest.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
jest_integration.js [Plugin Generator] Add integration test (#43219) 2019-09-06 13:10:47 -06:00
kbn.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
kibana.js Instrument Kibana with Elastic APM (#43548) 2019-12-04 15:21:07 +01:00
kibana_keystore.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
kibana_plugin.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
makelogs.js Removed old package, fix import (#31428) 2019-02-19 12:23:03 +01:00
mocha.js [FTR] Refactor mocha under @kbn/test (#42862) 2019-08-15 15:48:39 -06:00
notice.js Apache 2.0 license headers (#19383) 2018-05-28 20:06:30 -07:00
precommit_hook.js chore(NA): remove node version validator from git pre-commit hook script. (#19950) 2018-06-15 16:14:48 +01:00
README.md Plugin test readme’s (#26632) 2018-12-04 15:23:23 -05:00
register_git_hook.js Remove husky (#24887) 2018-11-15 01:34:45 +00:00
report_failed_tests.js refactor failed_tests_reporter to use TS, no octokit (#46993) 2019-10-08 13:56:07 -07:00
sasslint.js Add SCSS linting (#27328) 2019-01-03 09:01:43 -07:00
spec_to_console.js autofix all violations 2019-12-13 23:17:13 -07:00
storybook.js 📕 Storybook for everyone (take 2) (#43529) 2020-01-15 12:30:59 -08:00
type_check.js [TypeScript] add type-check script (#19325) 2018-08-09 17:19:24 -07:00
update_prs.js [scripts/update_prs] implement script to merge base branch into prs (#38302) 2019-06-06 18:31:08 -07:00

Kibana Dev Scripts

This directory contains scripts useful for interacting with Kibana tools in development. Use the node executable and --help flag to learn about how they work:

node scripts/{{script name}} --help

For Developers

This directory is excluded from the build and tools within it should help users discover their capabilities. Each script in this directory must:

  • require src/setup_node_env to bootstrap NodeJS environment
  • call out to source code in the src or packages directories
  • react to the --help flag
  • run everywhere OR check and fail fast when a required OS or toolchain is not available

Functional Test Scripts

node scripts/functional_tests [--config test/functional/config.js --config test/api_integration/config.js]

Runs all the functional tests: selenium tests and api integration tests. List configs with multiple --config arguments. Uses the @kbn/test library to run Elasticsearch and Kibana servers and tests against those servers, for multiple server+test setups. In particular, calls out to runTests(). Can be run on a single config.

node scripts/functional_tests_server [--config test/functional/config.js]

Starts just the Elasticsearch and Kibana servers given a single config, i.e. via --config test/functional/config.js or --config test/api_integration/config. Allows the user to start just the servers with this script, and keep them running while running tests against these servers. The idea is that the same config file configures both Elasticsearch and Kibana servers. Uses the startServers() method from @kbn/test library.

Example. Start servers and run tests, separately, but using the same config:

# Just the servers
node scripts/functional_tests_server --config path/to/config

In another terminal:

# Just the tests--against the running servers
node scripts/functional_test_runner --config path/to/config

For details on how the internal methods work, read this readme.

ES archiver

Loading data

If you wish to load up specific es archived data for your test, you can do so via:

node scripts/es_archiver.js load <archive> [--es-url=http://username:password@localhost:9200] [--kibana-url=http://username:password@localhost:5601/{basepath?}]

That will load the specified archive located in the archive directory specified by the default functional config file, located in test/functional/config.js. To load archives from other function config files you can pass --config path/to/config.js.

Note: The --es-url and --kibana-url options may or may not be neccessary depending on your current Kibana configuration settings, and their values may also change based on those settings (for example if you are not running with security you will not need the username:password portion).

Saving data

You can save existing data into an archive by using the save command:

node scripts/es_archiver.js save <archive name for kibana data> [space separated list of index patterns to include]

You may want to store the .kibana index separate from data. Since adding a lot of data will bloat our repo size, we have many tests that reuse the same data indices but use their own .kibana index.