elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.66k stars 8.23k forks source link

Kibana script “plugin_helpers” returns 0 even when failure is encountered #193927

Open kbujold opened 1 month ago

kbujold commented 1 month ago

Kibana version: Seen in ELK 8.11.1 and up

Elasticsearch version:
Seen in ELK 8.11.1 and up

Server OS version: NA

Browser version: NA

Browser OS version: NA

Original install method (e.g. download page, yum, from source, etc.):

Describe the bug:

The Kibana script "scripts/plugin_helpers" returns 0 even when failure is encountered. This is not optimal has we want our build to fail if there is an error.

yarn build
yarn run v1.22.21
$ yarn plugin-helpers build --debug --verbose
$ node ../../scripts/plugin_helpers build --debug --verbose
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
 debg KIBANA_CI_STATS_CONFIG environment variable not found, disabling CiStatsReporter
 info deleting the build and target directories
 debg creating build output dir [/localdisk/kbujold/WORKSPACE/wra-env/localdisk/designer/kbujold/wra-env/cgcs-root/wrs/analytics/git/elastic/kibana/plugins/wind/build/kibana/wind]
 info run bazel and build required artifacts for the optimizer
 succ bazel run successfully and artifacts were created
 info running @kbn/optimizer
 │ERROR Browserslist: caniuse-lite is outdated. Please run:
 │ info stopping @kbn/optimizer
 info compressing js and css bundles found at plugins/wind/build/kibana/wind/target/public to brotli
ERROR Error: ENOENT: no such file or directory, scandir '/localdisk/kbujold/WORKSPACE/wra-env/localdisk/designer/kbujold/wra-env/cgcs-root/wrs/analytics/git/elastic/kibana/plugins/wind/build/kibana/wind/target/public'
 info copying assets from `public/assets` to build
 info copying server source into the build and converting with babel
 info running yarn to install dependencies
 info compressing plugin into [wind-8.11.1.zip]
 succ plugin archive created
 debg CIStatsReporter committerHash: bce560392393d742e922
Done in 44.82s.

echo $?
0

To fix this issue I think there should be a process.exit(1); here after the log.

[elastic/kibana/blob/main/packages/kbn-plugin-helpers/src/tasks/brotli_compress_bundles.ts#L46](https://github.com/elastic/kibana/blob/main/packages/kbn-plugin-helpers/src/tasks/brotli_compress_bundles.ts#L46)

Image

Steps to reproduce: Create a kibana plugin. Cause a failure See the plugin-helpers return success

Expected behavior: The Plugin's yarn build should return an error if it encounters one

Screenshots (if relevant):

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context: Forum post regarding this issue https://discuss.elastic.co/t/kibana-script-plugin-helpers-returns-0-even-when-failure-is-encountered/364701

elasticmachine commented 1 month ago

Pinging @elastic/kibana-operations (Team:Operations)

ankita-mehta-bsn commented 1 month ago

How to fix the issue of browser. I keep getting even if i have installed with npx/yarn

ERROR Browserslist: caniuse-lite is outdated. Please run:
 │ info stopping @kbn/optimizer
kbujold commented 1 month ago

@ankita-mehta-bsn you can run this command npx update-browserslist-db@latest

ankita-mehta-bsn commented 1 month ago

@kbujold This npx update-browserslist-db@latest didnt help. There is more to it than just updating browserslist.

tdsalty commented 1 month ago

@kbujold This npx update-browserslist-db@latest didnt help. There is more to it than just updating browserslist.

This is true for me as well - should we open a new issue or is this an easy fix (I'm very new to plugin dev...)?

tdsalty commented 1 month ago

@kbujold This npx update-browserslist-db@latest didnt help. There is more to it than just updating browserslist.

This is true for me as well - should we open a new issue or is this an easy fix (I'm very new to plugin dev...)?

I'm answering my own question - if you run npx update-browserslist-db@latest in the main kibana directory it will update that dependency correctly and "free up" the plugin build.