nvm: Potential 0.40.0 regression on Github Actions runners
Poential 0.40.0 regression in Github Actions CI/CD
I tried to fill out the form, but it’s quite hard as most things simply don’t run. Here is a set of test workflows that show the regression.
Operating system and version:
Ubuntu 22.04 (Github Runner version 20240804.1.0)
nvm debug output:
# Impossible to run directly
nvm ls output:
# Impossible to run directly
How did you install nvm?
Pre-installed on Github Runner
What steps did you perform?
cat .nvmrc
source ~/.nvm/nvm.sh && nvm install
What happened?
Received output:
18
Error: Process completed with exit code 3.
What did you expect to happen?
Install of the node version specified in .nvmrc (18)
Is there anything in any of your profile files that modifies the PATH?
I don’t think so. It’s a fresh Github Action runner
If you are having installation issues, or getting “N/A”, what does curl -I --compressed -v https://nodejs.org/dist/ print out?
Please see workflow runs for demonstration of the apparent regression,
curl -I --compressed -v https://nodejs.org/dist/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 104.20.22.46:443...
* Connected to nodejs.org (104.20.22.46) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS header, Certificate Status (22):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.2 (IN), TLS header, Finished (20):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [4835 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [520 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.2 (OUT), TLS header, Finished (20):
} [5 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=*.nodejs.org
* start date: Feb 28 00:00:00 2024 GMT
* expire date: Mar 30 23:59:59 2025 GMT
* subjectAltName: host "nodejs.org" matched cert's "nodejs.org"
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* Using Stream ID: 1 (easy handle 0x56543f0b8e20)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
> HEAD /dist/ HTTP/2
> Host: nodejs.org
> user-agent: curl/7.81.0
> accept: */*
> accept-encoding: deflate, gzip, br, zstd
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
< HTTP/2 200
< date: Thu, 08 Aug 2024 12:30:09 GMT
< content-type: text/html
< cache-control: public, max-age=3600, s-maxage=14400
HTTP/2 200
date: Thu, 08 Aug 2024 12:30:09 GMT
content-type: text/html
cache-control: public, max-age=3600, s-maxage=14400
last-modified: Thu, 08 Aug 2024 11:05:18 GMT
cf-cache-status: HIT
age: 4469
vary: Accept-Encoding
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
server: cloudflare
cf-ray: 8aff841c88317d52-LAX
content-encoding: br
< last-modified: Thu, 08 Aug 2024 11:05:18 GMT
< cf-cache-status: HIT
< age: 4469
< vary: Accept-Encoding
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< server: cloudflare
< cf-ray: 8aff841c88317d52-LAX
< content-encoding: br
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host nodejs.org left intact
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 21 (8 by maintainers)
Commits related to this issue
- ci: downgrade nvm and install from github Downgrading to nvm v0.39.7, see this issue: - https://github.com/nvm-sh/nvm/issues/3405 Homebrew installation is not supported, see: - https://github.com/nv... — committed to thisconnect/bitbox-wallet-app by thisconnect 2 years ago
- ci: downgrade nvm and install from github Downgrading to nvm v0.39.7, see this issue: - https://github.com/nvm-sh/nvm/issues/3405 Homebrew installation is not supported, see: - https://github.com/nv... — committed to thisconnect/bitbox-wallet-app by thisconnect 2 years ago
- [Fix] `--save`: avoid a conflict with `set -e` Fixes #3405. — committed to ljharb/nvm by ljharb 2 years ago
ok, some bisecting suggests the issue was introduced in #2869: https://github.com/ljharb/ize/actions/runs/10328344009
I’ve got a fix; I’ll adapt the workflows into a regression test ~tomorrow~ soon, and then I can land and release this.
Unfortunately
set -eis itself fragile, and shouldn’t be set, but is still very widely used and erroneously understood.I was able to create solid regression tests, but they exposed they my fix wasn’t complete, and I’m still working on that fix.
The only workaround I know is downgrading to
v0.39.7before calling nvm via something like:Welcome to the family 🤗
Hopefully @ljharb will release a fix soon.
I ran into this issue and spent a while narrowing it down to the nvm version before finding this thread, but here’s my regression workflow that shows some difference between
v0.39.7andv0.40.0was the culprit (testing all between the current version in use on the runner, and the previous version in use by the runner,v0.39.5)Great find, thanks for looking into it!
At this point I’ll be locking my nvm workflows and a wrapper using nvm to version
0.39.7. But if any of my tests show any answers to your question I’ll report back.@AutomationD yeah, you’re misreading it - that’s just a predicate to determine if v18 is an iojs version (which it’s not, ofc).
ok, so the default options in that workflow are
ehB, which means there’s some change in v0.4.0 that breaks with set -e usage. Since it’s set with no action from you, telling you that it’s a bad idea to set that option does no good 😃 so I’ll see if I can figure out how to cover this scenario.The github action workflow was and will be very helpful here, both for repro, investigation, and later for a regression test.
I don’t think I use -e anywhere (see the test workflow I’ve created to reproduce this issue. It’s super simple) I’ve added -xv to the bash in Github Actions Workflow
Details
Edit: updated the run to match the install
The issue is definitely happening only when there is an .nvmrc present. I ran bash in debug mode (-xv), and I believe it was failing when trying to parse it.
It seems that 0.40.0 added comments support to .nvmrc, so it sounds like it might be a regression root (not confident).
I will add -xv back post the output when I’m back to this.
Adding onto my previous comment, I think there might be a bug / edge case with
.nvmrchandling.In my github action I did
echo .nvmrcand saw it hadlts/ironi.e. 20.9.0. I tried overwriting this with the latest lts20.16.0but the same error. Lastly I tried removing the.nvmrcfile entirely, and usingnvm install 20.16.0andnvm use 20.16.0which worked and node installed properly.The final working command for reference:
rm .nvmrc && . $nvmDir/nvm.sh && nvm install 20.16.0 && nvm use 20.16.0Here’s a similar actions failing - i’ve added
set -xhttps://github.com/matthewhilton/moodle-plugin-ci/actions/runs/10314237668/job/28552324807Full output:
I wonder if the difference is that your projects might have
.nvmrcbut ours don’t ?