For changes that may have major implications on existing Kibana usages of EUI, a built version of EUI should be tested against Kibana (ideally before being merged/released into EUI) to ensure that the upgrade process is as painless as possible.
Note that yarn link currently does not work with Kibana. You'll need to manually pack and insert it into Kibana to test locally.
EUI is a monorepo and to build and test eui locally in Kibana you'll need to ensure that the internal dependency packages are correctly linked as well.
First, update the package.json in eui/packages/eui as follows:
- remove
@elastic/eui-theme-commonfrom dependencies - add
"@elastic/eui-theme-common": "workspace:^"to devDependencies - add
"@elastic/eui-theme-common": "{CURRENT_VERSION}"to peerDependencies, e.g."@elastic/eui-theme-common": "1.0.0"
Then run the following command:
# eui/packages/eui
yarn build-packIf you made changes to eui-theme-common and/or eui-theme-borealis directories you'll need to build those packages as well:
# eui/packages/eui-theme-common
yarn build-pack# eui/packages/eui-theme-borealis
yarn build-packThis will create the required .tgz file(s) with the changes in your eui (and eui-theme-common/ eui-theme-borealis) directory. At this point you can move it anywhere.
Point the package.json file in Kibana to that file: "@elastic/eui": "/path/to/elastic-eui-xx.x.x.tgz". Then run the following commands at Kibana's root folder:
yarn kbn bootstrap --no-validate && yarn start- The
--no-validateflag is required when bootstrapping with a.tgz.- Change the name of the
.tgzafter subsequentyarn build-packsteps (e.g.,elastic-eui-xx.x.x-1.tgz,elastic-eui-xx.x.x-2.tgz). This is required foryarnto recognize new changes to the package.
- Change the name of the
- Running Kibana with
yarn startensures it starts in dev mode and doesn't use a previously cached version of EUI.
Elastic engineers have the option to deploy a local EUI package in Kibana. To do so, do the following:
- Follow the steps above to create a local package of EUI using
yarn build-pack - Copy the generated
.tgzpackage file(s) to the Kibana root - Point the
package.jsonfile in Kibana to that local file:"@elastic/eui": "file:./elastic-eui-xx.x.x.tgz". - Add
"@elastic/eui-theme-common"to thepackage.jsonand point it either to the local package you copied, or add the published version that matches the version listed as a dependency in your local@elastic/euipackage
# default release version, no local package for @elastic/eui-theme-common
"@elastic/eui-theme-common": "3.0.0"
# with local package added
"@elastic/eui-theme-common": "file:./elastic_eui_theme_common_xx.x.x.tgz"
- Run
yarn kbn bootstrap - Commit the changed files (
package.json.yarn.lockand EUI.tgzpackage) and push your branch - Create a Kibana (draft) pull request
After you have created a Kibana PR following the steps above, there are two ways you can deploy your local EUI package in Kibana.
- Add the labels
ci:cloud-deployandci:cloud-persist-deploymenton your PR and ensure the CI pipelines run by checking the "Click to trigger kibana-deploy-cloud-from-pr for this PR!" checkbox in the comment from elasticmachine - Once the pipelines are finished, kibanamachine will post a message with a link to the credentials on Buildkite, there you'll find a link to the deployment e.g. https://kibana-pr-228477.kb.us-west2.gcp.elastic-cloud.com and a command to get the credentials
- Run the
vaultcommand to get the credentials in your terminal (if you never used thevaultCLI, continue reading) - To use HashiCorp's
vaultCLI- Install it, if you're on a Mac you can use homebrew
- Login for the Infra Vault (production) by running:
export VAULT_ADDR=https://secrets.elastic.co:8200vault login -method=oidc
Follow the instructions in Kibana a la carte to deploy your PR.