Skip to content

Commit 52c79b4

Browse files
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: Samruddhi Khandale <[email protected]>
1 parent 07dc028 commit 52c79b4

13 files changed

+70
-17
lines changed

src/common-utils/main.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
362362
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
363363
fi
364364

365+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
366+
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
367+
# Update the repo files to reference vault.centos.org.
368+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
369+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
370+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
371+
fi
372+
365373
# Install packages for appropriate OS
366374
case "${ADJUSTED_ID}" in
367375
"debian")

src/go/install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ else
4343
exit 1
4444
fi
4545

46+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
47+
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
48+
# Update the repo files to reference vault.centos.org.
49+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
50+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
51+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
52+
fi
53+
4654
# Setup INSTALL_CMD & PKG_MGR_CMD
4755
if type apt-get > /dev/null 2>&1; then
4856
PKG_MGR_CMD=apt-get

src/node/devcontainer-feature.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "node",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"name": "Node.js (via nvm), yarn and pnpm",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/node",
66
"description": "Installs Node.js, nvm, yarn, pnpm, and needed dependencies.",
@@ -28,6 +28,20 @@
2828
"default": "/usr/local/share/nvm",
2929
"description": "The path where NVM will be installed."
3030
},
31+
"pnpmVersion": {
32+
"type": "string",
33+
"proposals": [
34+
"latest",
35+
"8.8.0",
36+
"8.0.0",
37+
"7.30.0",
38+
"6.14.8",
39+
"5.18.10",
40+
"none"
41+
],
42+
"default": "latest",
43+
"description": "Select or enter the PNPM version to install"
44+
},
3145
"nvmVersion": {
3246
"type": "string",
3347
"proposals": [

src/node/install.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Maintainer: The Dev Container spec maintainers
99

1010
export NODE_VERSION="${VERSION:-"lts"}"
11+
export PNPM_VERSION="${PNPMVERSION:-"latest"}"
1112
export NVM_VERSION="${NVMVERSION:-"latest"}"
1213
export NVM_DIR="${NVMINSTALLPATH:-"/usr/local/share/nvm"}"
1314
INSTALL_TOOLS_FOR_NODE_GYP="${NODEGYPDEPENDENCIES:-true}"
@@ -45,6 +46,14 @@ else
4546
exit 1
4647
fi
4748

49+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
50+
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
51+
# Update the repo files to reference vault.centos.org.
52+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
53+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
54+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
55+
fi
56+
4857
# Setup INSTALL_CMD & PKG_MGR_CMD
4958
if type apt-get > /dev/null 2>&1; then
5059
PKG_MGR_CMD=apt-get
@@ -370,16 +379,16 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
370379
fi
371380

372381
# Install pnpm
373-
if bash -c ". '${NVM_DIR}/nvm.sh' && type pnpm >/dev/null 2>&1"; then
374-
echo "pnpm already installed."
382+
if [ ! -z "${PNPM_VERSION}" ] && [ "${PNPM_VERSION}" = "none" ]; then
383+
echo "Ignoring installation of PNPM"
375384
else
376385
if bash -c ". '${NVM_DIR}/nvm.sh' && type npm >/dev/null 2>&1"; then
377386
(
378387
. "${NVM_DIR}/nvm.sh"
379388
[ ! -z "$http_proxy" ] && npm set proxy="$http_proxy"
380389
[ ! -z "$https_proxy" ] && npm set https-proxy="$https_proxy"
381390
[ ! -z "$no_proxy" ] && npm set noproxy="$no_proxy"
382-
npm install -g pnpm
391+
npm install -g pnpm@$PNPM_VERSION --force
383392
)
384393
else
385394
echo "Skip installing pnpm because npm is missing"

src/python/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "python",
3-
"version": "1.6.3",
3+
"version": "1.6.4",
44
"name": "Python",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/python",
66
"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.",

src/python/install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ else
6060
exit 1
6161
fi
6262

63+
if [ "${ADJUSTED_ID}" = "rhel" ] && [ "${VERSION_CODENAME-}" = "centos7" ]; then
64+
# As of 1 July 2024, mirrorlist.centos.org no longer exists.
65+
# Update the repo files to reference vault.centos.org.
66+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
67+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
68+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
69+
fi
70+
6371
# To find some devel packages, some rhel need to enable specific extra repos, but not on RedHat ubi images...
6472
INSTALL_CMD_ADDL_REPO=""
6573
if [ ${ADJUSTED_ID} = "rhel" ] && [ ${ID} != "rhel" ]; then

test/node/centos-7.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source dev-container-features-test-lib
77

88
# Definition specific tests
99
check "version" node --version
10-
check "pnpm" pnpm -v
10+
check "pnpm" bash -c "pnpm -v | grep 8.8.0"
1111
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
1212
check "yarn" yarn --version
1313

test/node/install_additional_node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source dev-container-features-test-lib
77

88
# 'lts' is now some version of node 20...
99
check "version_on_path" node -v | grep 20
10-
check "pnpm" pnpm -v
10+
check "pnpm" bash -c "pnpm -v | grep 8.8.0"
1111

1212
check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20
1313
check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3

test/node/install_additional_node_on_rhel_family.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source dev-container-features-test-lib
77

88
# 'lts' is now some version of node 20...
99
check "version_on_path" node -v | grep 20
10-
check "pnpm" pnpm -v
10+
check "pnpm" bash -c "pnpm -v | grep 6.16.0"
1111

1212
check "v20_installed" ls -1 /usr/local/share/nvm/versions/node | grep 20
1313
check "v14_installed" ls -1 /usr/local/share/nvm/versions/node | grep 14.19.3

test/node/install_node_16_on_bionic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source dev-container-features-test-lib
77

88
# Definition specific tests
99
check "version" bash -c "node --version | grep 16"
10-
check "pnpm" pnpm -v
10+
check "pnpm" bash -c "pnpm -v | grep 8.8.0"
1111
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
1212

1313
# Report result

0 commit comments

Comments
 (0)