Skip to content

Commit a082e2d

Browse files
authored
chore(ci): adopt own toolchain MONGOSH-864 (#2401)
1 parent c7fa0c7 commit a082e2d

File tree

8 files changed

+58
-159
lines changed

8 files changed

+58
-159
lines changed

.evergreen.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ functions:
122122
DISTRO_ID: ${distro_id}
123123
MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override}
124124
script: |
125-
source .evergreen/install-node.sh
126-
source .evergreen/install-npm-deps.sh
125+
set -e
126+
set -x
127+
.evergreen/install-node.sh
128+
.evergreen/install-npm-deps.sh
127129
- command: shell.exec
128130
params:
129131
working_dir: src
@@ -160,8 +162,10 @@ functions:
160162
DISTRO_ID: ${distro_id}
161163
MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override}
162164
script: |
163-
source .evergreen/install-node.sh
164-
source .evergreen/install-npm-deps.sh
165+
set -e
166+
set -x
167+
.evergreen/install-node.sh
168+
.evergreen/install-npm-deps.sh
165169
- command: s3.get
166170
type: setup
167171
params:

.evergreen/compile-artifact.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ elif [ -n "$MONGOSH_SHARED_OPENSSL" ]; then
7171
"--shared-openssl-libname='"$MONGOSH_OPENSSL_LIBNAME"'",
7272
"--shared-zlib"
7373
]'
74-
export LD_LIBRARY_PATH=/tmp/m/opt/lib
74+
# python3's ssl module may not work with the OpenSSL we built here,
75+
# so prefix the devtools toolchain one
76+
export LD_LIBRARY_PATH=/opt/devtools/lib:/tmp/m/opt/lib
7577
fi
7678

7779
export PUPPETEER_SKIP_DOWNLOAD="true"

.evergreen/evergreen.yml.in

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ functions:
131131
DISTRO_ID: ${distro_id}
132132
MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override}
133133
script: |
134-
source .evergreen/install-node.sh
135-
source .evergreen/install-npm-deps.sh
134+
set -e
135+
set -x
136+
.evergreen/install-node.sh
137+
.evergreen/install-npm-deps.sh
136138
- command: shell.exec
137139
params:
138140
working_dir: src
@@ -169,8 +171,10 @@ functions:
169171
DISTRO_ID: ${distro_id}
170172
MONOGDB_DRIVER_VERSION_OVERRIDE: ${mongodb_driver_version_override}
171173
script: |
172-
source .evergreen/install-node.sh
173-
source .evergreen/install-npm-deps.sh
174+
set -e
175+
set -x
176+
.evergreen/install-node.sh
177+
.evergreen/install-npm-deps.sh
174178
- command: s3.get
175179
type: setup
176180
params:

.evergreen/install-node-source.sh

Lines changed: 0 additions & 72 deletions
This file was deleted.

.evergreen/install-node.sh

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12
set -e
23
set -x
34
export BASEDIR="$PWD/.evergreen"
@@ -12,63 +13,22 @@ if [ "$OS" == "Windows_NT" ]; then
1213

1314
curl -sSfLO https://raw.githubusercontent.com/mongodb-js/compass/42e6142ae08be6fec944b80ff6289e6bcd11badf/.evergreen/node-gyp-bug-workaround.sh && bash node-gyp-bug-workaround.sh
1415
else
15-
if which realpath; then # No realpath on macOS, but also not needed there
16-
export HOME="$(realpath "$HOME")" # Needed to de-confuse nvm when /home is a symlink
17-
fi
18-
# Some Node.js driver versions leave a ~/.npmrc file lying around
19-
# that breaks nvm because it contains a 'prefix=' option (pointing
20-
# to a directory that no longer exists anyway).
21-
if [ -e "$HOME/.npmrc" ]; then
22-
# different `sed` arguments on macOS than for GNU sed ...
23-
if [ `uname` == Darwin ]; then
24-
sed -i'~' -e 's/^prefix=.*$//' "$HOME/.npmrc"
25-
else
26-
sed -i "$HOME/.npmrc" -e 's/^prefix=.*$//'
27-
fi
28-
fi
29-
export NVM_DIR="$BASEDIR/.nvm"
30-
mkdir -p "${NVM_DIR}"
31-
32-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
33-
34-
echo "Setting NVM environment home: $NVM_DIR"
35-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
36-
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
37-
38-
set +x # nvm is very verbose
39-
40-
# A few distros where pre-built node20 does not work out of the box and hence
41-
# needs to be built from source
42-
if [[ "${DISTRO_ID}" =~ ^(amazon2-|rhel7|ubuntu18|suse12) ]] && [[ "$NODE_JS_VERSION" =~ ^20 ]];
43-
then
44-
NODE_JS_SOURCE_VERSION="$NODE_JS_VERSION"
45-
if echo $NODE_JS_VERSION | grep -q ^20 ; then
46-
# Node.js 20.11.1 is the last 20.x that builds out of the box on RHEL7
47-
# https://github.com/nodejs/node/issues/52223
48-
NODE_JS_SOURCE_VERSION=20.11.1
49-
fi
50-
env NODE_JS_VERSION="$NODE_JS_SOURCE_VERSION" bash "$BASEDIR/install-node-source.sh"
51-
nvm use $NODE_JS_SOURCE_VERSION
52-
else
16+
if [ `uname` = Darwin ]; then
17+
export NVM_DIR="$BASEDIR/.nvm"
18+
mkdir -p "${NVM_DIR}"
19+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
20+
21+
echo "Setting NVM environment home: $NVM_DIR"
22+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
23+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
24+
set +x # nvm is very verbose
5325
echo nvm install --no-progress $NODE_JS_VERSION && nvm alias default $NODE_JS_VERSION
5426
nvm install --no-progress $NODE_JS_VERSION
5527
nvm alias default $NODE_JS_VERSION
5628
nvm use $NODE_JS_VERSION
29+
set -x
5730
fi
58-
set -x
59-
60-
if env PATH="/opt/chefdk/gitbin:$PATH" git --version | grep -q 'git version 1.'; then
61-
(cd "$BASEDIR" &&
62-
curl -sSfL https://github.com/git/git/archive/refs/tags/v2.31.1.tar.gz | tar -xvz &&
63-
mv git-2.31.1 git-2 &&
64-
cd git-2 &&
65-
make -j8 NO_EXPAT=1)
66-
fi
67-
6831
npm cache clear --force || true # Try to work around `Cannot read property 'pickAlgorithm' of null` errors in CI
69-
# Started observing CI failures on RHEL 7.2 (s390x) for installing npm, all
70-
# related to network issues hence adding a retry with backoff here.
71-
bash "$BASEDIR/retry-with-backoff.sh" npm i -g npm@$NPM_VERSION
7232
fi
7333

7434
. "$BASEDIR/setup-env.sh"

.evergreen/install-npm-deps.sh

100644100755
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
#!/bin/bash
12
set -e
23
set -x
4+
export BASEDIR="$PWD/.evergreen"
35

4-
if [[ "${DISTRO_ID}" =~ ^(rhel|ubuntu1804) ]]; then
5-
# RHEL and Ubuntu 18.04 use Python 3.6 which isn't supported by newer node-gyp versions
6-
npm i node-gyp@9 --verbose --force
7-
fi
6+
. "$BASEDIR/setup-env.sh"
87

98
npm ci --verbose
109
echo "MONOGDB_DRIVER_VERSION_OVERRIDE:$MONOGDB_DRIVER_VERSION_OVERRIDE"

.evergreen/setup-env.sh

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,9 @@ set -e
22
set -x
33

44
OS_ARCH="$(uname "-m")"
5-
if [ "$OS_ARCH" = "ppc64le" ] || [ "$OS_ARCH" = "ppc64" ]; then
6-
echo "[INFO] Choosing v4 because OS_ARCH is $OS_ARCH"
7-
export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v4/bin'
8-
else
9-
echo "[INFO] Choosing v3 because OS_ARCH is $OS_ARCH"
10-
export TOOLCHAIN_PATH='/opt/mongodbtoolchain/v3/bin'
11-
fi
125

136
export BASEDIR="$PWD/.evergreen"
14-
export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/opt/python/3.6/bin:$BASEDIR/mingit/cmd:$BASEDIR/mingit/mingw64/libexec/git-core:$BASEDIR/git-2:$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:/opt/chefdk/gitbin:/cygdrive/c/cmake/bin:$TOOLCHAIN_PATH:$PATH"
7+
export PATH="$BASEDIR/npm-10/node_modules/.bin:$BASEDIR/node-v$NODE_JS_VERSION-win-x64:/opt/java/jdk16/bin:$PATH"
158

169
export MONGOSH_GLOBAL_CONFIG_FILE_FOR_TESTING="$BASEDIR/../../testing/tests-globalconfig.conf"
1710

@@ -26,38 +19,46 @@ fi
2619
echo "TERM variable is set to '${TERM:-}'"
2720

2821
if [ "$OS" != "Windows_NT" ]; then
29-
if which realpath; then # No realpath on macOS, but also not needed there
30-
export HOME="$(realpath "$HOME")" # Needed to de-confuse nvm when /home is a symlink
31-
fi
32-
export NVM_DIR="$BASEDIR/.nvm"
33-
echo "Setting NVM environment home: $NVM_DIR"
34-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
35-
set +x # nvm is very verbose
36-
echo nvm use $NODE_JS_VERSION || nvm use 20.11.1
37-
nvm use $NODE_JS_VERSION || nvm use 20.11.1 # see install-node.sh
38-
set -x
39-
export PATH="$NVM_BIN:$PATH"
40-
4122
if [ `uname` = Darwin ]; then
4223
echo "Using clang version:"
4324
(which clang && clang --version)
4425

4526
echo "Using clang++ version:"
4627
(which clang++ && clang++ --version)
28+
29+
export NVM_DIR="$BASEDIR/.nvm"
30+
echo "Setting NVM environment home: $NVM_DIR"
31+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
32+
set +x # nvm is very verbose
33+
nvm use $NODE_JS_VERSION
34+
set -x
35+
export PATH="$NVM_BIN:$PATH"
4736
else
37+
export PATH="/opt/devtools/bin:$PATH"
38+
export GIT_EXEC_PATH="/opt/devtools/libexec/git-core"
4839
export CC=gcc
4940
export CXX=g++
41+
export PYTHON="/opt/devtools/bin/python3"
5042

5143
echo "Using gcc version:"
5244
(which gcc && gcc --version)
5345

5446
echo "Using g++ version:"
5547
(which g++ && g++ --version)
5648
fi
49+
else
50+
export PATH="/cygdrive/c/python/Python311/Scripts:/cygdrive/c/python/Python311:/cygdrive/c/Python311/Scripts:/cygdrive/c/Python311:/cygdrive/c/cmake/bin:$PATH"
51+
fi
5752

58-
if [ -x "$BASEDIR/git-2/git" ]; then
59-
export GIT_EXEC_PATH="$BASEDIR/git-2"
60-
fi
53+
NODE_JS_MAJOR_VERSION=$(echo "$NODE_JS_VERSION" | awk -F . '{print $1}')
54+
if echo "$NODE_JS_MAJOR_VERSION" | grep -q '^[0-9]*$'; then
55+
export PATH="/opt/devtools/node$NODE_JS_MAJOR_VERSION/bin:$PATH"
56+
echo "Detected Node.js version (requested v${NODE_JS_MAJOR_VERSION}.x):"
57+
node -v
58+
node -v | grep -q "^v$NODE_JS_MAJOR_VERSION"
59+
else
60+
echo "Cannot identify major version from NODE_JS_VERSION: $NODE_JS_VERSION"
61+
exit 1
6162
fi
6263

6364
export EVERGREEN_EXPANSIONS_PATH="$BASEDIR/../../tmp/expansions.yaml"

packages/connectivity-tests/test/localhost.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function try_connect_ipv4only_dualstackhostname() {
4747
# Use a second docker container to be able to modify /etc/hosts easily
4848
cat <<EOF | docker run -i --rm --network host -v /:/host "${DOCKER_BASE_IMG}" bash && FAILED=no || FAILED=yes
4949
export PATH=/host$(echo "$PATH" | sed 's~:~:/host~g'):\$PATH
50+
if [ -e /host/opt/devtools/lib ]; then cp -v /host/opt/devtools/lib/lib{crypto,ssl}* /lib/x86_64-linux-gnu ; fi # Node.js on the host may require modern OpenSSL
5051
apt update && apt -y install openssl # necessary on Ubuntu 20.04
5152
5253
set -e

0 commit comments

Comments
 (0)