Skip to content

Commit 24ecb6e

Browse files
committed
In CI scripts, nodesource.com is often flaky, instead check if sufficient node version is already present
Especially in github we have seend deb.nodesource.com not work repeatedly. The image we currently use on github includes a sufficient node, v20.19.5 so no need to install something else there. https://github.com/actions/runner-images/blob/ubuntu22/20251112.150/images/ubuntu/Ubuntu2204-Readme.md Ticket: ENT-13521 Changelog: none
1 parent 5eb8b25 commit 24ecb6e

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

ci/setup.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,19 @@ sudo apt-get -qy install bison flex binutils build-essential fakeroot ntp \
4040
sudo apt-get -qq purge apache* "postgresql*" redis*
4141

4242
# packages needed for installing Mission portal dependencies
43-
# remove any nodejs or node- packages currently in place
44-
sudo apt-get remove -qy 'nodejs*' 'node-*'
45-
# replace with exact version we want
46-
wget -O - https://deb.nodesource.com/setup_20.x | sudo -E bash -
47-
sudo apt-get install -qy nodejs
43+
44+
MINIMUM_NODE_VERSION=20
45+
echo "Check for at least $MINIMUM_NODE_VERSION node version"
46+
if command -v node; then
47+
# vMAJOR.MINOR.PATCH
48+
_major=$(node --version | cut -dv -f2 | cut -d. -f1)
49+
if [ "$_major" -lt "$MINIMUM_NODE_VERSION" ]; then
50+
echo "We need at least node version $MINIMUM_NODE_VERSION and found $_major. Will attempt to install from nodesource"
51+
52+
# remove any nodejs or node- packages currently in place
53+
sudo apt-get remove -qy 'nodejs*' 'node-*'
54+
# replace with exact version we want
55+
wget -O - https://deb.nodesource.com/setup_20.x | sudo -E bash -
56+
sudo apt-get install -qy nodejs
57+
fi
58+
fi

0 commit comments

Comments
 (0)