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

build(travis): travis cache and nvm install hotfix #8623

Merged
merged 7 commits into from
May 31, 2018
Merged

Conversation

joshuarli
Copy link
Member

@joshuarli joshuarli commented May 31, 2018

Well, this is interesting. The nvm/node-related changes introduced in #8617 made master fail when merged (but not in the PR). This seems to be a combination of issues with travis cache purging and nvm doing poor version presence checking.

What's happening is with travis uncached "${HOME}/.nvm/versions/node/v$(< .nvmrc)":

$ nvm install
v8.9.1 is already installed.
Now using node v8.9.1

Notice how (npm v...) is not present. That comes from this:

nvm_print_npm_version () {
	if nvm_has "npm"
	then
		command printf " (npm v$(npm --version 2>/dev/null))"
	fi
}

npm_has is just type "${1-}" > /dev/null 2>&1. So npm isn't there, which is correct, since travis cache is empty. Or is it?

Why would nvm install report 8.9.1 (from our .nvmrc) already installed?

nvm_is_version_installed () {
	[ -n "${1-}" ] && [ -d "$(nvm_version_path "${1-}" 2> /dev/null)" ]
}

It's just a directory exist check. But it's empty:

$ nvm install
Found '/home/travis/build/getsentry/sentry/.nvmrc' with version <8.9.1>
v8.9.1 is already installed.
Now using node v8.9.1
$ ls -lah "${HOME}/.nvm/versions/node/v$(< .nvmrc)"
total 8.0K
drwxrwxr-x 2 travis travis 4.0K May 31 21:41 .
drwxr-xr-x 5 travis travis 4.0K May 31 21:41 ..

And nvm isn't warning against this. Instead it happily reports node is installed and doesn't do anything else. It should be checking for an executable ${HOME}/.nvm/versions/node/v8.9.1/bin/node instead.

Clearing the cache should in theory remove the entire "${HOME}/.nvm/versions/node/v$(< .nvmrc)". But despite purging travis cache via the web UI, this empty folder still persists.

The temporary hotfix is to remove that dir if it's empty so nvm install can populate the cache.

If nvm install is changed so that it better detects the presence of a node version as suggested above, then we don't need this hotfix.

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

Successfully merging this pull request may close these issues.

2 participants