Unverified Commit 460684dd authored by Gaurav Saini's avatar Gaurav Saini Committed by GitHub

[Node] - nvm - fallback to previous version - code fix (#904)

* [node] - nvm - added fallback to prev. version - if latest version tag released but binary not found

* bumped patch version
parent 8af4ce3d
{ {
"id": "node", "id": "node",
"version": "1.4.0", "version": "1.4.1",
"name": "Node.js (via nvm), yarn and pnpm", "name": "Node.js (via nvm), yarn and pnpm",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
"description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.", "description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.",
......
...@@ -293,8 +293,11 @@ set -e ...@@ -293,8 +293,11 @@ set -e
umask 0002 umask 0002
# Do not update profile - we'll do this manually # Do not update profile - we'll do this manually
export PROFILE=/dev/null export PROFILE=/dev/null
curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh" | bash curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh" | bash || {
PREV_NVM_VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/\${PREV_NVM_VERSION}/install.sh" | bash
NVM_VERSION="\${PREV_NVM_VERSION}"
}
source "${NVM_DIR}/nvm.sh" source "${NVM_DIR}/nvm.sh"
if [ "${NODE_VERSION}" != "" ]; then if [ "${NODE_VERSION}" != "" ]; then
nvm alias default "${NODE_VERSION}" nvm alias default "${NODE_VERSION}"
......
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
set -e
trap 'echo "Error occurred at line $LINENO"; exit 1' ERR
source /usr/local/share/nvm/nvm.sh
#check nvm version
echo -e "\n✅ nvm version as installed by feature = v$(nvm --version)";
NVM_DIR="/usr/local/share/nvm"
NODE_VERSION="lts"
FAKE_NVM_VERSION="1.2.XYZ"
curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/v${FAKE_NVM_VERSION}/install.sh" | bash || {
PREV_NVM_VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
curl -so- "https://raw.githubusercontent.com/nvm-sh/nvm/${PREV_NVM_VERSION}/install.sh" | bash
NVM_VERSION="${PREV_NVM_VERSION}"
}
#check nvm version
echo -e "\n✅ nvm version as installed by test = v$(nvm --version)";
# Report result
reportResults
{ {
"nvm_test_fallback": {
"image": "debian:11",
"features": {
"node": {
"version": "lts"
}
}
},
"install_additional_node": { "install_additional_node": {
"image": "debian:11", "image": "debian:11",
"features": { "features": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment