Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using re2 for Timelion regular expressions #67416

Merged
merged 8 commits into from
Jun 10, 2020
Merged

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented May 26, 2020

No description provided.

@kobelb kobelb requested a review from a team May 26, 2020 20:59
@kobelb kobelb requested a review from a team as a code owner May 26, 2020 20:59
@kobelb kobelb added release_note:skip Skip the PR/issue when compiling release notes v8.0.0 v7.9.0 labels May 26, 2020
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kobelb
Copy link
Contributor Author

kobelb commented May 27, 2020

@elasticmachine merge upstream

@@ -78,7 +78,7 @@ export default {
],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest',
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'node'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, the build was failing with the following error:

Cannot find module './build/Release/re2' from 're2.js'

However, Jest was able to find:
    'build/Release/re2.node'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'ts', 'tsx'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

'node' is already in the defaults, and I'm not sure why we're overriding the defaults. @elastic/kibana-operations mind double-checking this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the defaults have changed over the years to include ts/tsx, but didn't originally, which is probably why we're overriding them. LGTM, though I'm not opposed to just deleting the override and using the defaults either (in this and other files too).

@@ -9,7 +9,7 @@ export function createJestConfig({ kibanaDirectory, xPackKibanaDirectory }) {
return {
rootDir: xPackKibanaDirectory,
roots: ['<rootDir>/plugins', '<rootDir>/legacy/plugins', '<rootDir>/legacy/server'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'node'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to be consistent with src/dev/jest/config.js, this change isn't needed at this time.

@@ -28,7 +28,7 @@ export default {
],
coverageDirectory: '<rootDir>/../target/kibana-coverage/jest',
coverageReporters: ['html'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'node'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to be consistent with src/dev/jest/config.js, this change isn't needed at this time.

@kobelb kobelb requested a review from spalger May 27, 2020 01:56
@kobelb
Copy link
Contributor Author

kobelb commented May 27, 2020

retest

2 similar comments
@kobelb
Copy link
Contributor Author

kobelb commented May 27, 2020

retest

@kobelb
Copy link
Contributor Author

kobelb commented May 27, 2020

retest

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -78,7 +78,7 @@ export default {
],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest',
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx'],
moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'node'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the defaults have changed over the years to include ts/tsx, but didn't originally, which is probably why we're overriding them. LGTM, though I'm not opposed to just deleting the override and using the defaults either (in this and other files too).

@kobelb
Copy link
Contributor Author

kobelb commented Jun 1, 2020

@elasticmachine merge upstream

@kobelb kobelb requested a review from a team June 1, 2020 14:41
Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested locally

@watson
Copy link
Contributor

watson commented Jun 3, 2020

@kobelb I thought re2 wanted to implement this solution upstream and that we, therefore, wanted to wait for that?

@kobelb
Copy link
Contributor Author

kobelb commented Jun 3, 2020

@watson node-re2 implemented the changes to provide pre-built binaries. This allows Kibana to just reference and use node-re2 like any other npm package for most situations. However, when building Kibana's platform specific archives, we need to patch the pre-built binaries into the archives hence the work being done here: https://github.com/elastic/kibana/pull/67416/files#diff-dc74fa4ea2f321221fbe2ed00d29a120

@watson
Copy link
Contributor

watson commented Jun 4, 2020

Ah ok, I missed that 👍

I'm used to - when shipping pre-built binaries - that they are all included inside the npm package instead of relying on a post-install script that downloads them from a 3rd party website.

I'm not really sure I like this approach, but I guess in this case we will have to deal with it as you do here 👍

@kobelb
Copy link
Contributor Author

kobelb commented Jun 4, 2020

@elasticmachine merge upstream

@kobelb kobelb requested a review from flash1293 June 4, 2020 14:14
@flash1293
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Mac and regexes for labels still work in Timelion. LGTM

Screenshot 2020-06-10 at 17 04 30

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kobelb kobelb added the v6.8.11 label Jun 10, 2020
@kobelb kobelb merged commit e616935 into elastic:master Jun 10, 2020
@kobelb kobelb deleted the node-re2-2 branch June 10, 2020 16:55
kobelb added a commit to kobelb/kibana that referenced this pull request Jun 10, 2020
* Revert "Revert "Using re2 for Timelion regular expressions (elastic#55208)""

This reverts commit c90293d.

* Updating re2 to 1.14.0. Still need to update build patching

* Extract the gzip to the destination, supporting multiple extract methods

* Adding 'node' to jest's moduleFileExtensions

'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring

Co-authored-by: Elastic Machine <[email protected]>
kobelb added a commit to kobelb/kibana that referenced this pull request Jun 11, 2020
* Revert "Revert "Using re2 for Timelion regular expressions (elastic#55208)""

This reverts commit c90293d.

* Updating re2 to 1.14.0. Still need to update build patching

* Extract the gzip to the destination, supporting multiple extract methods

* Adding 'node' to jest's moduleFileExtensions

'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring

Co-authored-by: Elastic Machine <[email protected]>
@kobelb kobelb added the v7.8.1 label Jun 11, 2020
kobelb added a commit that referenced this pull request Jun 11, 2020
* Revert "Revert "Using re2 for Timelion regular expressions (#55208)""

This reverts commit c90293d.

* Updating re2 to 1.14.0. Still need to update build patching

* Extract the gzip to the destination, supporting multiple extract methods

* Adding 'node' to jest's moduleFileExtensions

'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 12, 2020
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

2 similar comments
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

kobelb added a commit that referenced this pull request Jun 18, 2020
* Revert "Revert "Using re2 for Timelion regular expressions (#55208)""

This reverts commit c90293d.

* Updating re2 to 1.14.0. Still need to update build patching

* Extract the gzip to the destination, supporting multiple extract methods

* Adding 'node' to jest's moduleFileExtensions

'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
kobelb added a commit that referenced this pull request Jun 18, 2020
* Revert "Revert "Using re2 for Timelion regular expressions (#55208)""

This reverts commit c90293d.

* Updating re2 to 1.14.0. Still need to update build patching

* Extract the gzip to the destination, supporting multiple extract methods

* Adding 'node' to jest's moduleFileExtensions

'node' is in the defaults, not sure why we aren't using the defaults...
https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v6.8.11 v7.8.1 v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants