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

[SDK Automation] Java automation script doesn't need to install node 18 repeatedly #7966

Closed
Tracked by #8039
raych1 opened this issue Mar 28, 2024 · 4 comments
Closed
Tracked by #8039
Assignees

Comments

@raych1
Copy link
Member

raych1 commented Mar 28, 2024

Node 18 has been installed in the spec PR pipeline and each SDK language automation script should not need to install it.
The following is the pipeline log from the spec PR:

01:20:36.523 cmderr W 	[init.sh] [notice] A new release of pip is available: 23.0.1 -> 24.0
01:20:36.523 cmderr W 	[init.sh] [notice] To update, run: pip install --upgrade pip
01:20:36.589 cmderr W 	[init.sh] Average Speed   Time    Time     Time  Current
01:20:36.589 cmderr W 	[init.sh]                                  Dload  Upload   Total   Spent    Left  Speed
01:20:36.603 cmderr W 	[init.sh] 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0    0  1110k      0 --:--:-- --:--:-- --:--:-- 1110k
01:20:36.610 cmdout 	[init.sh] => nvm is already installed in /home/cloudtest/.nvm, trying to update using git
01:20:37.196 cmdout 	[init.sh] 
=> => Compressing and cleaning up git repository
01:20:37.201 cmdout 	[init.sh] => Appending nvm source string to /home/cloudtest/.bashrc
01:20:37.202 cmdout 	[init.sh] => Appending bash_completion source string to /home/cloudtest/.bashrc
01:20:38.362 cmdout 	[init.sh] => You currently have modules installed globally with `npm`. These will no
01:20:38.362 cmdout 	[init.sh] => longer be linked to the active version of Node when you install a new node
01:20:38.363 cmdout 	[init.sh] => with `nvm`; and they may (depending on how you construct your `$PATH`)
01:20:38.363 cmdout 	[init.sh] => override the binaries of modules installed with `nvm`:
01:20:38.363 cmdout 	[init.sh] /opt/hostedtoolcache/node/18.19.1/x64/lib
01:20:38.363 cmdout 	[init.sh] +-- corepack@0.22.0
01:20:38.363 cmdout 	[init.sh] => If you wish to uninstall them at a later point (or re-install them under your
01:20:38.363 cmdout 	[init.sh] => `nvm` Nodes), you can remove them from the system Node as follows:
01:20:38.363 cmdout 	[init.sh]      $ nvm use system
01:20:38.363 cmdout 	[init.sh]      $ npm uninstall -g a_module
01:20:38.364 cmdout 	[init.sh] => Close and reopen your terminal to start using nvm or run the following to use it now:
01:20:38.364 cmdout 	[init.sh] export NVM_DIR="$HOME/.nvm"
01:20:38.364 cmdout 	[init.sh] [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
01:20:38.364 cmdout 	[init.sh] [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
01:20:38.625 cmdout 	[init.sh] Downloading and installing node v18.15.0...
01:20:38.696 cmderr W 	[init.sh] Downloading https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz...
01:20:38.822 cmderr W 	[init.sh] ##################################### 100.0%
01:20:38.834 cmderr W 	[init.sh] Computing checksum with sha256sum
01:20:38.927 cmderr W 	[init.sh] Checksums matched!
01:20:40.965 cmdout 	[init.sh] Now using node v18.15.0 (npm v9.5.0)
01:20:41.072 cmdout 	[init.sh] default -> node (-> v18.15.0 *)
01:20:41.074 warn 	Script return with result [warning] code [0] signal [null] cwd [azure-sdk-for-java]: ./eng/mgmt/automation/init.sh
01:20:41.074 endsection 	Call initScript
01:20:41.074 info 	Read temp file azure-sdk-for-java_tmp/initOutput.json with content:
01:20:41.074 info 	{
  "envs": {
    "PATH": "/usr/lib/jvm/temurin-11-jdk-amd64/bin:/home/cloudtest/.nvm/versions/node/v18.15.0/bin:/mnt/vss/_work/1/a/unified-pipeline-runtime/private/azure-rest-api-specs-pipeline/node_modules/.bin:/opt/hostedtoolcache/Python/3.10.13/x64/bin:/opt/hostedtoolcache/Python/3.10.13/x64:/opt/hostedtoolcache/node/18.19.1/x64/bin:/snap/bin:/home/cloudtest/.local/bin:/opt/pipx_bin:/home/cloudtest/.cargo/bin:/home/cloudtest/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/cloudtest/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
    "JAVA_HOME": "/usr/lib/jvm/temurin-11-jdk-amd64"
  }
}

@weidongxu-microsoft

@weidongxu-microsoft
Copy link
Member

@raych1
Copy link
Member Author

raych1 commented Mar 29, 2024

Ray, do you mean we just remove the code in init.sh? https://github.com/Azure/azure-sdk-for-java/blob/main/eng/mgmt/automation/init.sh#L7-L11

@haolingdong-msft

@weidongxu-microsoft , I would suggest to remove it if init.sh is only used by SDK automation. But if this script is also used for other purpose, let's check if node has been installed before installing it.

@haolingdong-msft
Copy link
Member

PR created: Azure/azure-sdk-for-java#39465

@haolingdong-msft
Copy link
Member

@raych1, the PR is created. But one thing I don't quite understand is in the log you pasted, there is cmderr, I thought there should not be error even we installed twice. Could you please let me know why the error occurs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants