-
Notifications
You must be signed in to change notification settings - Fork 916
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 selecting the Node.js binary OSD uses #3508
Conversation
54526fc
to
0556cfd
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.
@@ -0,0 +1,97 @@ | |||
#!/bin/sh |
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.
Not recommended as ubuntu is using ash
linking to sh
.
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.
This is what OSD used before but I see that OS uses #!/usr/bin/env bash
. Shall I use that?
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.
Ahhh, if that is the case better just keep #!/bin
as not all the docker images install env
by default as well.
On debian I have already force a #!/bin/bash
just to avoid.
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.
I really dont have too much solution to this generalized script tho.
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.
If OS is already using env, then we probably can just use.
At least env is more common than which not being installed.
Thanks.
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.
@peterzhuamazon I did some reading and most of what I found reasonable indicate a preference for using #!/bin/sh
.
https://stackoverflow.com/a/55927235
https://unix.stackexchange.com/a/496523
https://www.ixsystems.com/blog/migrating-from-linux-to-freebsd/
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 @AMoo-Miki !
I have no issue with that then.
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.
So it was intentional to not make this use_node.sh and set as bin/bash? If so should we migrate the other shell scripts to this format?
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.
@AMoo-Miki any comment about the above ^
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.
We should standardize what we do. I will raise an issue for it.
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #3508 +/- ##
==========================================
+ Coverage 66.41% 66.47% +0.05%
==========================================
Files 3206 3206
Lines 61597 61597
Branches 9503 9503
==========================================
+ Hits 40909 40944 +35
+ Misses 18410 18380 -30
+ Partials 2278 2273 -5
Flags with carried forward coverage won't be shown. Click here to find out more. see 8 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
0556cfd
to
a149fad
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.
Just a nitpik
a149fad
to
3cb0909
Compare
b63875d
to
bce4f0a
Compare
scripts/use_node
Outdated
|
||
SCRIPT="$0" | ||
|
||
OS=$(uname -s | awk '{print tolower}') |
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.
awk '{print tolower}'
is failing for me so I don't get an OS. $OS outputs as empty for me on my Ubuntu
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. Peter made this suggestion. I will revert back to what we had before.
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.
I reverted this piece.
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.
@peterzhuamazon I had to revert this change.
0762642
to
8e0d6a3
Compare
Did we want to update stuff where we reference
And update the packages package.json like:
|
8c38067
to
88f95e3
Compare
I did not change the instructions since |
New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]>
88f95e3
to
90ef3d6
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.
Awesome!
Barring the creation of the follow standardization and some dev documentation. LGTM!
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.
My bash-fu is incredibly limited, so I'm not sure I'm able to catch much in the actual implementation, but looks good to me!
|
||
ENDLOCAL | ||
ENDLOCAL |
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.
nit - missing blank line?
@AMoo-Miki @kavilla This is just targeting |
New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> (cherry picked from commit cb472dc) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]>
Correct. 1.x will need some extra love to use this. |
New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]>
…3633) * added prepare command Signed-off-by: kappassov <[email protected]> * Use mirrors to download Node.js binaries to escape sporadic 404 errors (#3619) Issue Resolved: #3618 Signed-off-by: Anan Zhuang <[email protected]> * Allow selecting the Node.js binary OSD uses (#3508) New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> * Clean up and rebuild @osd/pm (#3570) * Fix the build failures * Removed some unused packages * Update gist url templates in Lychee's exclusion list Signed-off-by: Miki <[email protected]> * Refactor dev tool console to use opensearch-js client to send request (#3544) Refactor dev tool console to use opensearch-js client to interact with OpenSearch Signed-off-by: Su <[email protected]> * updates after the 1st review Signed-off-by: kappassov <[email protected]> --------- Signed-off-by: kappassov <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Su <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Co-authored-by: Miki <[email protected]> Co-authored-by: Zhongnan Su <[email protected]>
…3633) * added prepare command Signed-off-by: kappassov <[email protected]> * Use mirrors to download Node.js binaries to escape sporadic 404 errors (#3619) Issue Resolved: #3618 Signed-off-by: Anan Zhuang <[email protected]> * Allow selecting the Node.js binary OSD uses (#3508) New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> * Clean up and rebuild @osd/pm (#3570) * Fix the build failures * Removed some unused packages * Update gist url templates in Lychee's exclusion list Signed-off-by: Miki <[email protected]> * Refactor dev tool console to use opensearch-js client to send request (#3544) Refactor dev tool console to use opensearch-js client to interact with OpenSearch Signed-off-by: Su <[email protected]> * updates after the 1st review Signed-off-by: kappassov <[email protected]> --------- Signed-off-by: kappassov <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Su <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Co-authored-by: Miki <[email protected]> Co-authored-by: Zhongnan Su <[email protected]> (cherry picked from commit b0146e7) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…3633) (#3651) * added prepare command * Use mirrors to download Node.js binaries to escape sporadic 404 errors (#3619) Issue Resolved: #3618 * Allow selecting the Node.js binary OSD uses (#3508) New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. * Clean up and rebuild @osd/pm (#3570) * Fix the build failures * Removed some unused packages * Update gist url templates in Lychee's exclusion list * Refactor dev tool console to use opensearch-js client to send request (#3544) Refactor dev tool console to use opensearch-js client to interact with OpenSearch * updates after the 1st review --------- (cherry picked from commit b0146e7) Signed-off-by: kappassov <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Su <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Anan Zhuang <[email protected]> Co-authored-by: Miki <[email protected]> Co-authored-by: Zhongnan Su <[email protected]>
…pensearch-project#3633) * added prepare command Signed-off-by: kappassov <[email protected]> * Use mirrors to download Node.js binaries to escape sporadic 404 errors (opensearch-project#3619) Issue Resolved: opensearch-project#3618 Signed-off-by: Anan Zhuang <[email protected]> * Allow selecting the Node.js binary OSD uses (opensearch-project#3508) New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> * Clean up and rebuild @osd/pm (opensearch-project#3570) * Fix the build failures * Removed some unused packages * Update gist url templates in Lychee's exclusion list Signed-off-by: Miki <[email protected]> * Refactor dev tool console to use opensearch-js client to send request (opensearch-project#3544) Refactor dev tool console to use opensearch-js client to interact with OpenSearch Signed-off-by: Su <[email protected]> * updates after the 1st review Signed-off-by: kappassov <[email protected]> --------- Signed-off-by: kappassov <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Su <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Co-authored-by: Miki <[email protected]> Co-authored-by: Zhongnan Su <[email protected]>
New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> Signed-off-by: David Sinclair <[email protected]>
…pensearch-project#3633) * added prepare command Signed-off-by: kappassov <[email protected]> * Use mirrors to download Node.js binaries to escape sporadic 404 errors (opensearch-project#3619) Issue Resolved: opensearch-project#3618 Signed-off-by: Anan Zhuang <[email protected]> * Allow selecting the Node.js binary OSD uses (opensearch-project#3508) New reusable use_node scripts take care of selecting the correct Node.js binary based OSD_NODE_HOME, OSD_HOME, and whatever is in the PATH. It also takes care of finding the binary on FreeBSD. * The startup scripts check `OSD_NODE_HOME` and `NODE_HOME` before falling back to use the bundled or system-wide Node.js binary. * Update `package.json` to replace `node` with `use_node`. * Update file templates and shell scripts to internally use `use_node`. * Update the build scripts to copy `use_node` into releases * Make tests that execute node internally, honor the binary being used. Signed-off-by: Miki <[email protected]> * Clean up and rebuild @osd/pm (opensearch-project#3570) * Fix the build failures * Removed some unused packages * Update gist url templates in Lychee's exclusion list Signed-off-by: Miki <[email protected]> * Refactor dev tool console to use opensearch-js client to send request (opensearch-project#3544) Refactor dev tool console to use opensearch-js client to interact with OpenSearch Signed-off-by: Su <[email protected]> * updates after the 1st review Signed-off-by: kappassov <[email protected]> --------- Signed-off-by: kappassov <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Su <[email protected]> Co-authored-by: Anan Zhuang <[email protected]> Co-authored-by: Miki <[email protected]> Co-authored-by: Zhongnan Su <[email protected]> Signed-off-by: David Sinclair <[email protected]>
while [ -h "$SCRIPT" ] ; do | ||
loc=$(ls -ld "$SCRIPT") | ||
# Drop everything prior to -> | ||
link=$(expr "$loc" : '.*-> \(.*\)$') |
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.
why not something like realpath "$SCRIPT"
?
nvm i just found realpath
is not part of posix
Description
New reusable
use_node
scripts take care of selecting the correct Node.js binary basedOSD_NODE_HOME
,OSD_HOME
, and whatever is in thePATH
. It also takes care of finding the binary on FreeBSD.OSD_NODE_HOME
andNODE_HOME
before falling back to use the bundled or system-wide Node.js binary.package.json
to replacenode
withuse_node
.use_node
into releasesIssues Resolved
Fixes #1219
Fixes #3502
Partially serves #3095
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr