-
Notifications
You must be signed in to change notification settings - Fork 919
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
Allow node patch versions to be higher on runtime #1189
Allow node patch versions to be higher on runtime #1189
Conversation
b40dbb3
to
03f47ec
Compare
Linting failed. Run |
03f47ec
to
d3a773d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! This looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you!
Hello @hashworks, thanks for the changes! Also, seems to resolve a big headache from the community. Verified it seems to work great! I could be overthinking. But I think it might be worth to have some indication of the version of Node.js that OpenSearch Dashboards was built with in the error message. As a developer on this project, it is pretty easy to find which explicit version to use but it might not be for others. The reason why I suggest this is that there is an inherit risk enabling a version that was not used in development and that was verified in a release process, albeit it small since it is a patch version. I'd rather if we could guide people on the verified version but let them know that they are empowered to make the decision that they accept the risk of using any other patch version could save a potential deep dive. That said, the before behavior was always used the bundled node however now the logic seems seems to increase in more support that would be helpful to begin add to the documentation site, or least in a markdown file. |
@hashworks any comment on the above? Let me know if I can answer any questions. Thank you. |
Sorry for the delay, I've been a bit busy lately. Well,
|
I think it would be I +1 that message, @tmarkley, @boktorbb-amzn, @kgcreative, @keithhc2 any thoughts? |
Agree that it should be |
e34f2db
to
3e94742
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks.
I see the 1.3
label is added to this, I'm hesitant to classify this as a minor version change since it's a major change in behavior (albeit it does a less strict check).
@kavilla that's reasonable, especially since 1.x is still on Node.js v10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvements! I think there's an opportunity to add a few more tests, but otherwise this looks great.
@@ -37,15 +37,18 @@ var pkg = require('../../package.json'); | |||
var currentVersion = (process && process.version) || null; | |||
var rawRequiredVersion = (pkg && pkg.engines && pkg.engines.node) || null; | |||
var requiredVersion = rawRequiredVersion ? 'v' + rawRequiredVersion : rawRequiredVersion; | |||
var isVersionValid = !!currentVersion && !!requiredVersion && currentVersion === requiredVersion; | |||
var requiredVersionMajorMinor = requiredVersion.match(/^v(\d+\.\d+)/)[1]; | |||
var isVersionValid = requiredVersionMajorMinor === currentVersion.match(/^v(\d+\.\d+)/)[1]; | |||
|
|||
// Validates current the NodeJS version compatibility when OpenSearch Dashboards starts. | |||
if (!isVersionValid) { | |||
var errorMessage = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add at least one test to confirm that this error message spits out what we expect? I don't see any current tests that validate these regex expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 14166cd... but please verify that this is what you had in mind. I can't really test a fixed string because it changes with the used node version.
I have moved this 2.1.0 because I think we should act on Tommy's responses but I think we can build this in a way that enables us to call this a feature. Sorry about the delay on this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking to ensure 2.0.0-rc1 stability.
d2b7bd4
to
fa69e60
Compare
My bad, I didn't have time to fix things up. |
This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` Signed-off-by: Justin Kromlinger <[email protected]>
Signed-off-by: Justin Kromlinger <[email protected]>
Signed-off-by: Justin Kromlinger <[email protected]>
Tests versions that are greater than and less than the current version. Signed-off-by: Justin Kromlinger <[email protected]>
Signed-off-by: Justin Kromlinger <[email protected]>
Signed-off-by: Justin Kromlinger <[email protected]>
a28c8ed
to
0218576
Compare
Codecov Report
@@ Coverage Diff @@
## main #1189 +/- ##
=======================================
Coverage 68.09% 68.09%
=======================================
Files 3072 3072
Lines 59032 59034 +2
Branches 8928 8928
=======================================
+ Hits 40198 40200 +2
Misses 16647 16647
Partials 2187 2187
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these tests. Love how you are testing for the different major, minor and patch versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the improvements! This looks great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thank you
Just wanted to follow up, as you stated before it help people who do not have the pre-bundled Node. Will just re-hash that behavior might seem inconsistent for end-users and developers who do not have the insight here. Perhaps we can add the |
Good as is, potentially needs docs or env variable
This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]> (cherry picked from commit 0a24652)
…#1189) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]>
…#1189) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]>
This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]> (cherry picked from commit 0a24652)
…#1189) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]>
…#1189) (opensearch-project#1677) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]> (cherry picked from commit 0a24652)
…#1189) (opensearch-project#1677) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]> (cherry picked from commit 0a24652)
…#1189) This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily. ```shell % grep 14.18 ../../package.json "node": "14.18.2", % nvm use 12 Now using node v12.22.8 (npm v6.14.15) % node node_version_validator.js OpenSearch Dashboards does not support the current Node.js version v12.22.8. Please use Node.js ~v14.18. % nvm use 14 Now using node v14.18.3 (npm v6.14.15) % node node_version_validator.js % ``` * Mention Node.js version Dashboards was built with in runtime check error * Use template literals in node version validator * Add additional node validator tests, cleanup * Don't allow node patch versions to be lower on runtime Signed-off-by: Justin Kromlinger <[email protected]>
This adjusts the runtime node version check to only compare major and minor version requirements. Systems that don't use the bundled NodeJS might update their node due to security patches, which would currently break OpenSearch Dashboards unnecessarily.