Skip to content

[8.19] Add conditional switching between EUI releases (#219818)#221920

Merged
tkajtoch merged 2 commits intoelastic:8.19from
tkajtoch:backport/8.19/pr-219818
May 29, 2025
Merged

[8.19] Add conditional switching between EUI releases (#219818)#221920
tkajtoch merged 2 commits intoelastic:8.19from
tkajtoch:backport/8.19/pr-219818

Conversation

@tkajtoch
Copy link
Member

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

## Summary

This PR simplifies the weekly EUI upgrade and backport process by
conditionally aliasing `@elastic/eui` in shared deps webpack
configurations.

# Backstory

The EUI team (@elastic/eui-team) is responsible for keeping EUI up to
date in Kibana. Historically, this has been a relatively straightforward
(yet time-consuming) process, however, due to `8.x` backport
complexities caused by it using a different theme, it has become way
more demanding on everybody involved.

EUI is released on weekly basis. Each week, we release official EUI
versions tagged `latest` in npmjs and get a PR open that updates the
package in kibana `main`.

Our upgrade PRs tend to require anywhere between 2 and 25 codeowner
reviews due to the number of snapshots we need to update while working
on the EUI upgrade PRs. These snapshot changes are 99% of the time
harmless, yet it still takes 2+ full workdays to ping teams and get all
reviews necessary to get the PR merged. Generally speaking, we aim to
have the upgrade PR open on Monday and merged by Friday.

## The issue with `8.x` backports

Kibana 8.x uses the Amsterdam theme instead of Borealis, which is used
in Kibana 9.0 and up. To keep 8.x up to date, for each official EUI
release we prepare another special Kibana 8.x only release of EUI (e.g.,
`101.2.0-amsterdam.0`). These special releases have the theme hardcoded
to Amsterdam at compile-time to avoid any initial theme errors Kibana
could otherwise experience. This is done primarily because some areas in
Kibana read EUI theme values outside of React components, and we have no
stable way to determine what the active theme is since there's no
context information. This is where we need to fall back to Amsterdam in
8.x and Borealis in 9.x.

**Since there are two different EUI versions - one for Kibana `main` and
9.0, and another for 8.x branches, we cannot use the automated backports
feature**. Instead, we open two separate PRs and configure backport
labels accordingly. Having two PRs is far from ideal since codeowners
need to review our changes twice, and we're more likely to make
mistakes.

# Our proposal

Following the recently introduced React version switching logic, we want
to conditionally switch between two `@elastic/eui` releases depending on
the kibana branch/version while keeping automated backports possible.

To achieve that, I added a dependency alias `@elastic/eui-amsterdam`
that points to the Amsterdam EUI release and configured `resolve.alias`
in shared deps to resolve the correct dependency based on the optional
`EUI_AMSTERDAM` environment variable. When this change is merged to
`main` and backported to `9.0` and `8.19`, I'll open a follow-up PR to
the `8.19` branch updating the default value of `EUI_AMSTERDAM` to
`"true"`. This should result in no conflicts and be easy to follow.

Since 8.19 [uses the Amsterdam release of
`@elastic/eui`](https://github.com/elastic/kibana/blob/8.19/package.json#L126)
(e.g., `101.2.0-amsterdam.0`), there's no risk backporting this PR as-is
without `EUI_AMSTERDAM` configured beforehand.

## What does it change?

With this setup, we'll be able to update versions of `@elastic/eui` and
`@elastic/eui-amsterdam` at the same time in a single PR and make use of
automated kibana backports. There will be only one set of changes to
review by codeowners, and if there are any failing tests when
backporting to `8.19` due to, for example, changed color values, we can
follow the regular kibana procedures and fix them right in the created
backport PR. It'll simplify our workflow quite drastically while keeping
the same level of quality.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit ac3fc27)

# Conflicts:
#	package.json
#	packages/kbn-dependency-ownership/src/rule.ts
#	src/dev/license_checker/config.ts
#	src/platform/packages/private/kbn-ui-shared-deps-npm/BUILD.bazel
#	src/platform/packages/private/kbn-ui-shared-deps-src/BUILD.bazel
#	yarn.lock
@tkajtoch tkajtoch requested a review from kibanamachine as a code owner May 29, 2025 11:44
@tkajtoch tkajtoch added the backport This PR is a backport of another PR label May 29, 2025
@tkajtoch tkajtoch enabled auto-merge (squash) May 29, 2025 11:44
@elasticmachine
Copy link
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #5 / AppRouter calls mount handler and returned unmount function when navigating between apps
  • [job] [logs] Jest Integration Tests #5 / AppRouter calls mount handler and returned unmount function when navigating between apps
  • [job] [logs] Jest Integration Tests #5 / AppRouter can navigate between standard application and one with custom appRoute
  • [job] [logs] Jest Integration Tests #5 / AppRouter can navigate between standard application and one with custom appRoute
  • [job] [logs] Jest Integration Tests #5 / AppRouter can navigate between two applications with custom appRoutes
  • [job] [logs] Jest Integration Tests #5 / AppRouter can navigate between two applications with custom appRoutes

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #15 / CustomFields renders correctly

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
controls 541.5KB 541.7KB +201.0B
dashboard 680.5KB 680.7KB +201.0B
infra 1.7MB 1.7MB +202.0B
kubernetesSecurity 267.2KB 267.4KB +201.0B
maps 3.1MB 3.1MB +202.0B
ml 5.5MB 5.5MB +202.0B
visTypeVega 2.1MB 2.1MB +201.0B
total +1.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-npmDll 6.0MB 6.0MB +1.0KB

History

@tkajtoch tkajtoch merged commit d7d5e7b into elastic:8.19 May 29, 2025
8 checks passed
delanni added a commit to delanni/kibana that referenced this pull request Jan 19, 2026
delanni added a commit that referenced this pull request Jan 22, 2026
## Summary

Revert "[8.19] Add conditional switching between EUI releases (#219818)
(#221920)"

This reverts commit d7d5e7b.

Having 2 dependencies point to the same version of the same dependency
on npm seems to wreck yarn's logic, and causes issues on bootstrap. We
no longer need this parallel variant of the dependency, so we can just
remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants