chore: skip node upgrade if latest on cwctl upgrade (#8336)

This commit is contained in:
Vishnu Narayanan
2023-11-20 12:48:39 +05:30
committed by GitHub
parent 6c8dacfa0d
commit 5b3f9ac1cd

View File

@@ -754,8 +754,31 @@ function upgrade_redis() {
apt install libvips -y
}
##############################################################################
# Update nodejs to v20+
# Globals:
# None
# Arguments:
# None
# Outputs:
# None
##############################################################################
function upgrade_node() {
echo "Upgrading nodejs version to v20.x"
echo "Checking Node.js version..."
# Get current Node.js version
current_version=$(node --version | cut -c 2-)
# Parse major version number
major_version=$(echo "$current_version" | cut -d. -f1)
if [ "$major_version" -ge 20 ]; then
echo "Node.js is already version $current_version (>= 20.x). Skipping Node.js upgrade."
return
fi
echo "Upgrading Node.js version to v20.x"
curl -sL https://deb.nodesource.com/setup_20.x | sudo bash -
apt install -y nodejs
}