Unverified Commit 52c79b49 authored by Prathamesh Zarkar's avatar Prathamesh Zarkar Committed by GitHub

Features update logic for PPA in bionic (#1079)

* Features update logic for PPA in bionic

* node failing fixed after pnpm install from npm package manager

* for node version 16 pnpm version 7 is installed

* uninstalled pnpm package first and then reinstalled as per node version

* force installing pnpm package

* optimized logic to install compatible pnpm for node 16

* pnpm install specific version compatible for node

* new variable added pnpmVersion in node feature

* test case failure fixed

* fixed test cases

* fixing test cases

* pnpm version fixed for test cases

* default version for pnpm updated

* review comments addressed

* Update src/node/devcontainer-feature.json

---------
Co-authored-by: 's avatarSamruddhi Khandale <samruddhikhandale@github.com>
parent 07dc0288
...@@ -362,6 +362,14 @@ if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then ...@@ -362,6 +362,14 @@ if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi fi
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
# Update the repo files to reference vault.centos.org.
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
# Install packages for appropriate OS # Install packages for appropriate OS
case "${ADJUSTED_ID}" in case "${ADJUSTED_ID}" in
"debian") "debian")
......
...@@ -43,6 +43,14 @@ else ...@@ -43,6 +43,14 @@ else
exit 1 exit 1
fi fi
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
# Update the repo files to reference vault.centos.org.
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
# Setup INSTALL_CMD & PKG_MGR_CMD # Setup INSTALL_CMD & PKG_MGR_CMD
if type apt-get > /dev/null 2>&1; then if type apt-get > /dev/null 2>&1; then
PKG_MGR_CMD=apt-get PKG_MGR_CMD=apt-get
......
{ {
"id": "node", "id": "node",
"version": "1.5.0", "version": "1.6.0",
"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.",
...@@ -28,6 +28,20 @@ ...@@ -28,6 +28,20 @@
"default": "/usr/local/share/nvm", "default": "/usr/local/share/nvm",
"description": "The path where NVM will be installed." "description": "The path where NVM will be installed."
}, },
"pnpmVersion": {
"type": "string",
"proposals": [
"latest",
"8.8.0",
"8.0.0",
"7.30.0",
"6.14.8",
"5.18.10",
"none"
],
"default": "latest",
"description": "Select or enter the PNPM version to install"
},
"nvmVersion": { "nvmVersion": {
"type": "string", "type": "string",
"proposals": [ "proposals": [
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# Maintainer: The Dev Container spec maintainers # Maintainer: The Dev Container spec maintainers
export NODE_VERSION="${VERSION:-"lts"}" export NODE_VERSION="${VERSION:-"lts"}"
export PNPM_VERSION="${PNPMVERSION:-"latest"}"
export NVM_VERSION="${NVMVERSION:-"latest"}" export NVM_VERSION="${NVMVERSION:-"latest"}"
export NVM_DIR="${NVMINSTALLPATH:-"/usr/local/share/nvm"}" export NVM_DIR="${NVMINSTALLPATH:-"/usr/local/share/nvm"}"
INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}" INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}"
...@@ -45,6 +46,14 @@ else ...@@ -45,6 +46,14 @@ else
exit 1 exit 1
fi fi
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
# Update the repo files to reference vault.centos.org.
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
# Setup INSTALL_CMD & PKG_MGR_CMD # Setup INSTALL_CMD & PKG_MGR_CMD
if type apt-get > /dev/null 2>&1; then if type apt-get > /dev/null 2>&1; then
PKG_MGR_CMD=apt-get PKG_MGR_CMD=apt-get
...@@ -370,8 +379,8 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then ...@@ -370,8 +379,8 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
fi fi
# Install pnpm # Install pnpm
if bash -c ". '${NVM_DIR}/nvm.sh' && type pnpm >/dev/null 2>&1"; then if [ ! -z "${PNPM_VERSION}" ] && [ "${PNPM_VERSION}" = "none" ]; then
echo "pnpm already installed." echo "Ignoring installation of PNPM"
else else
if bash -c ". '${NVM_DIR}/nvm.sh' && type npm >/dev/null 2>&1"; then if bash -c ". '${NVM_DIR}/nvm.sh' && type npm >/dev/null 2>&1"; then
( (
...@@ -379,7 +388,7 @@ else ...@@ -379,7 +388,7 @@ else
[ ! -z "$http_proxy" ] && npm set proxy="$http_proxy" [ ! -z "$http_proxy" ] && npm set proxy="$http_proxy"
[ ! -z "$https_proxy" ] && npm set https-proxy="$https_proxy" [ ! -z "$https_proxy" ] && npm set https-proxy="$https_proxy"
[ ! -z "$no_proxy" ] && npm set noproxy="$no_proxy" [ ! -z "$no_proxy" ] && npm set noproxy="$no_proxy"
npm install -g pnpm npm install -g pnpm@$PNPM_VERSION --force
) )
else else
echo "Skip installing pnpm because npm is missing" echo "Skip installing pnpm because npm is missing"
......
{ {
"id": "python", "id": "python",
"version": "1.6.3", "version": "1.6.4",
"name": "Python", "name": "Python",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
"description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.", "description": "Installs the provided version of Python, as well as PIPX, and other common Python utilities. JupyterLab is conditionally installed with the python feature. Note: May require source code compilation.",
......
...@@ -60,6 +60,14 @@ else ...@@ -60,6 +60,14 @@ else
exit 1 exit 1
fi fi
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
# Update the repo files to reference vault.centos.org.
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
fi
# To find some devel packages, some rhel need to enable specific extra repos, but not on RedHat ubi images... # To find some devel packages, some rhel need to enable specific extra repos, but not on RedHat ubi images...
INSTALL_CMD_ADDL_REPO="" INSTALL_CMD_ADDL_REPO=""
if [ ${ADJUSTED_ID} = "rhel" ] && [ ${ID} != "rhel" ]; then if [ ${ADJUSTED_ID} = "rhel" ] && [ ${ID} != "rhel" ]; then
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" node --version check "version" node --version
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 8.8.0"
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
check "yarn" yarn --version check "yarn" yarn --version
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# 'lts' is now some version of node 20... # 'lts' is now some version of node 20...
check "version_on_path" node -v | grep 20 check "version_on_path" node -v | grep 20
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 8.8.0"
check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20 check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20
check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3 check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# 'lts' is now some version of node 20... # 'lts' is now some version of node 20...
check "version_on_path" node -v | grep 20 check "version_on_path" node -v | grep 20
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 6.16.0"
check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20 check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20
check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3 check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" bash -c "node --version | grep 16" check "version" bash -c "node --version | grep 16"
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 8.8.0"
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result # Report result
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" bash -c "node --version" check "version" bash -c "node --version"
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 6.16.0"
check "nvm version" bash -c ". /usr/local/share/nvm/nvm.sh && nvm --version | grep 0.39" check "nvm version" bash -c ". /usr/local/share/nvm/nvm.sh && nvm --version | grep 0.39"
# Report result # Report result
......
...@@ -7,7 +7,7 @@ source dev-container-features-test-lib ...@@ -7,7 +7,7 @@ source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
check "version" node --version check "version" node --version
check "pnpm" pnpm -v check "pnpm" bash -c "pnpm -v | grep 8.8.0"
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10" check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
# Report result # Report result
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"features": { "features": {
"node": { "node": {
"version": "lts", "version": "lts",
"additionalVersions": "v17.9.1,v14.19.3" "additionalVersions": "v17.9.1,v14.19.3",
"pnpmVersion": "8.8.0"
} }
} }
}, },
...@@ -21,7 +22,8 @@ ...@@ -21,7 +22,8 @@
"features": { "features": {
"node": { "node": {
"version": "lts", "version": "lts",
"additionalVersions": "v17.9.1,v14.19.3" "additionalVersions": "v17.9.1,v14.19.3",
"pnpmVersion": "6.16.0"
} }
} }
}, },
...@@ -30,7 +32,8 @@ ...@@ -30,7 +32,8 @@
"remoteUser": "vscode", "remoteUser": "vscode",
"features": { "features": {
"node": { "node": {
"version": "latest" "version": "latest",
"pnpmVersion": "8.8.0"
} }
} }
}, },
...@@ -78,7 +81,8 @@ ...@@ -78,7 +81,8 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-18.04", "image": "mcr.microsoft.com/devcontainers/base:ubuntu-18.04",
"features": { "features": {
"node": { "node": {
"version": "16" "version": "16",
"pnpmVersion":"8.8.0"
} }
} }
}, },
...@@ -86,7 +90,8 @@ ...@@ -86,7 +90,8 @@
"image": "mcr.microsoft.com/devcontainers/base", "image": "mcr.microsoft.com/devcontainers/base",
"features": { "features": {
"node": { "node": {
"nvmVersion": "0.39" "nvmVersion": "0.39",
"pnpmVersion": "6.16.0"
} }
} }
}, },
...@@ -102,7 +107,8 @@ ...@@ -102,7 +107,8 @@
"image": "centos:centos7", "image": "centos:centos7",
"features": { "features": {
"node": { "node": {
"version": "16" "version": "16",
"pnpmVersion": "8.8.0"
} }
} }
}, },
......
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