Skip to content

Commit 9f673af

Browse files
committed
Merge remote-tracking branch 'origin/main' into 1.31-releases
2 parents 3c548c8 + 4daa8ef commit 9f673af

File tree

58 files changed

+1443
-3085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1443
-3085
lines changed

.evergreen.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ tasks:
440440
compass_distribution: compass
441441
- func: package
442442
vars:
443-
debug: 'hadron*,mongo*,compass*'
443+
debug: 'hadron*,mongo*,compass*,electron*'
444444
compass_distribution: compass
445445
- func: save-windows-artifacts
446446
vars:
@@ -472,7 +472,7 @@ tasks:
472472
compass_distribution: compass-isolated
473473
- func: package
474474
vars:
475-
debug: 'hadron*,mongo*,compass*'
475+
debug: 'hadron*,mongo*,compass*,electron*'
476476
compass_distribution: compass-isolated
477477
- func: save-windows-artifacts
478478
vars:
@@ -504,7 +504,7 @@ tasks:
504504
compass_distribution: compass-readonly
505505
- func: package
506506
vars:
507-
debug: 'hadron*,mongo*,compass*'
507+
debug: 'hadron*,mongo*,compass*,electron*'
508508
compass_distribution: compass-readonly
509509
- func: save-windows-artifacts
510510
vars:
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
3+
# This is a workaround for a node-gyp bug that has not fully been investigated
4+
# due to problems reproducing it outside of CI environments (even though it
5+
# occurs both in evergreen and github actions).
6+
# Something seems to go wrong when node-gyp extracts the Node.js header tarball,
7+
# on Windows specifically (this is most likely because node-tar treats
8+
# the overwriting of existing files differently on Windows than on other OS --
9+
# for good reasons, but still).
10+
# The most likely cause of this issue is that node-gyp somehow extracts the
11+
# same headers tarball twice, in parallel, in the same location, with race
12+
# conditions in the tar extraction code leading to issues.
13+
# The extraction result ends up in %LOCALAPPDATA%\node-gyp\Cache.
14+
# Manually extracting the tarballs will solve this issue, so we're doing that
15+
# here.
16+
# For actually resolving the bug, we would probably need somebody with a local
17+
# reproduction. However, it seems likely that other people will also encounter
18+
# this issue, so there's also a good chance that this workaround will just
19+
# not be needed with a future node-gyp version.
20+
21+
if [ x"$NODE_JS_VERSION" = x"" ]; then
22+
if node -v; then
23+
export NODE_JS_VERSION=$(node -p 'process.version.slice(1)')
24+
else
25+
echo "Need NODE_JS_VERSION to be set or Node.js to be installed for node-gyp bug workaround script"
26+
exit 1
27+
fi
28+
fi
29+
30+
if [ x"$LOCALAPPDATA" = x"" ]; then
31+
echo "No LOCALAPPDATA set, ignoring node-gyp bug workaround script"
32+
exit
33+
fi
34+
35+
set -x
36+
CACHEDIR="$LOCALAPPDATA/node-gyp/Cache"
37+
rm -rvf "$CACHEDIR"
38+
mkdir -p "$CACHEDIR/$NODE_JS_VERSION"
39+
cd "$CACHEDIR/$NODE_JS_VERSION"
40+
curl -sSfLO "https://nodejs.org/download/release/v$NODE_JS_VERSION/node-v$NODE_JS_VERSION-headers.tar.gz"
41+
tar --strip-components=1 -xvzf "node-v$NODE_JS_VERSION-headers.tar.gz"
42+
for arch in x64 x86 arm64; do
43+
mkdir $arch
44+
pushd $arch
45+
curl -sSfLO "https://nodejs.org/download/release/v$NODE_JS_VERSION/win-$arch/node.lib" || echo "no $arch v$NODE_JS_VERSION .lib file"
46+
popd
47+
done
48+
49+
# Finally, store the right installVersion value for current node-gyp versions
50+
echo 9 > installVersion

.evergreen/preinstall.sh

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
#!/usr/bin/env bash
22

3-
if [[ $OSTYPE == "cygwin" ]]; then
4-
export PLATFORM='win32'
5-
export IS_WINDOWS=true
6-
elif [[ `uname` == Darwin ]]; then
7-
export PLATFORM='darwin'
8-
export IS_OSX=true
9-
else
10-
export PLATFORM='linux'
11-
export IS_LINUX=true
12-
if [[ `cat /etc/*release | grep ^NAME | grep Red` ]]; then
13-
export IS_RHEL=true
14-
elif [[ `cat /etc/*release | grep ^NAME | grep Ubuntu` ]]; then
15-
export IS_UBUNTU=true
16-
fi
17-
fi
18-
193
echo "========================="
204
echo "Important Environment Variables"
215
echo "========================="
@@ -51,6 +35,9 @@ if [ -n "$IS_WINDOWS" ]; then
5135
./node.exe node_modules/npm2/bin/npm-cli.js i -g npm@$NPM_VERSION
5236
rm -rf node_modules/npm2/
5337
chmod +x npm.cmd npm
38+
39+
cd ..
40+
.evergreen/node-gyp-bug-workaround.sh
5441
else
5542
echo "Installing nodejs v${NODE_JS_VERSION} for ${PLATFORM}..."
5643
curl -fs \
@@ -69,4 +56,4 @@ else
6956

7057
./bin/node lib/node_modules/npm2/bin/npm-cli.js i -g npm@$NPM_VERSION
7158
rm -rf lib/node_modules/npm2/
72-
fi
59+
fi

.evergreen/print-compass-env.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ function printVar(name, value) {
1919
}
2020

2121
function printCompassEnv() {
22-
const {
23-
EVERGREEN_BUILD_VARIANT
24-
} = process.env;
25-
2622
let {
2723
// This is an env var set in bash that we exported in print-compass-env.sh
2824
OSTYPE
@@ -48,34 +44,41 @@ function printCompassEnv() {
4844
# - https://github.com/mongodb-js/compass/pull/2403
4945
# - https://github.com/mongodb-js/compass/pull/2410
5046
*/
51-
if (originalPWD.startsWith('\/cygdrive\/c')) {
47+
if (originalPWD.startsWith('/cygdrive/c')) {
5248
// Change cygdrive from c to z without chanding rest of the path
53-
newPWD = originalPWD.replace('\/cygdrive\/c', '\/cygdrive\/z');
49+
newPWD = originalPWD.replace('/cygdrive/c', '/cygdrive/z');
5450
// we have to change the directory in the shell script we're outputting, not in this node process
5551
console.log(`cd "${newPWD}";`);
5652
console.log('echo "Changed cwd on cygwin. Current working dir: $PWD";');
5753
}
5854

59-
const pathsToPrepend = []
55+
const pathsToPrepend = [];
6056

6157
if (OSTYPE === 'cygwin') {
6258
// NOTE lucas: for git-core addition, See
6359
// https://jira.mongodb.org/browse/COMPASS-4122
6460
pathsToPrepend.unshift('/cygdrive/c/wixtools/bin');
6561
pathsToPrepend.unshift(`${newPWD}/.deps`);
66-
pathsToPrepend.unshift('/cygdrive/c/Program Files/Git/mingw32/libexec/git-core');
67-
printVar('APPDATA', 'Z:\\\;');
62+
pathsToPrepend.unshift(
63+
'/cygdrive/c/Program Files/Git/mingw32/libexec/git-core'
64+
);
65+
printVar('APPDATA', 'Z:\\;');
6866
} else {
6967
pathsToPrepend.unshift(`${newPWD}/.deps/bin`);
7068
}
7169

72-
if (EVERGREEN_BUILD_VARIANT === 'rhel') {
70+
if (process.env.IS_RHEL === 'true') {
7371
// To build node modules on RHEL post electron 13 we need
7472
// a newer c++ compiler version, this adds it.
7573
// https://jira.mongodb.org/browse/COMPASS-5150
7674
pathsToPrepend.unshift('/opt/mongodbtoolchain/v3/bin');
7775
}
7876

77+
if (process.env.PLATFORM === 'linux') {
78+
// Make sure that linux is using python 3.6 (node-gyp requirement)
79+
pathsToPrepend.unshift('/opt/python/3.6/bin');
80+
}
81+
7982
PATH = maybePrependPaths(PATH, pathsToPrepend);
8083
printVar('PATH', PATH);
8184

@@ -91,6 +94,13 @@ function printCompassEnv() {
9194
printVar('npm_config_cache', npmCacheDir);
9295
// npm tmp is deprecated, but let's keep it around just in case
9396
printVar('npm_config_tmp', npmTmpDir);
97+
98+
printVar('PLATFORM', process.env.PLATFORM);
99+
printVar('IS_WINDOWS', process.env.IS_WINDOWS);
100+
printVar('IS_OSX', process.env.IS_OSX);
101+
printVar('IS_LINUX', process.env.IS_LINUX);
102+
printVar('IS_RHEL', process.env.IS_RHEL);
103+
printVar('IS_UBUNTU', process.env.IS_UBUNTU);
94104
}
95105

96106
printCompassEnv();

.evergreen/print-compass-env.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
#! /usr/bin/env bash
22

3+
if [[ $OSTYPE == "cygwin" ]]; then
4+
export PLATFORM='win32'
5+
export IS_WINDOWS=true
6+
elif [[ $(uname) == Darwin ]]; then
7+
export PLATFORM='darwin'
8+
export IS_OSX=true
9+
else
10+
export PLATFORM='linux'
11+
export IS_LINUX=true
12+
if [[ $(cat /etc/*release | grep ^NAME | grep Red) ]]; then
13+
export IS_RHEL=true
14+
elif [[ $(cat /etc/*release | grep ^NAME | grep Ubuntu) ]]; then
15+
export IS_UBUNTU=true
16+
fi
17+
fi
18+
319
export BASHPATH="$PATH"
420
export OSTYPE="$OSTYPE"
521

6-
.evergreen/print-compass-env.js
22+
.evergreen/print-compass-env.js

.github/workflows/authors-and-third-party-notices.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ jobs:
2525
- name: Install [email protected]
2626
run: |
2727
npm install -g [email protected]
28-
npx --yes rimraf $LOCALAPPDATA/node-gyp/Cache || true
28+
29+
- name: Run node-gyp bug workaround script
30+
run: |
31+
bash .evergreen/node-gyp-bug-workaround.sh
2932
3033
- name: Install Dependencies
3134
run: |

.github/workflows/build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ jobs:
5252
- name: Install [email protected]
5353
run: |
5454
npm install -g [email protected]
55-
npx --yes rimraf $LOCALAPPDATA/node-gyp/Cache || true
55+
56+
- name: Run node-gyp bug workaround script
57+
run: |
58+
bash .evergreen/node-gyp-bug-workaround.sh
5659
5760
- name: Install Dependencies
5861
run: |

.github/workflows/check-test.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ jobs:
4949
- name: Install [email protected]
5050
run: |
5151
npm install -g [email protected]
52-
npx --yes rimraf $LOCALAPPDATA/node-gyp/Cache || true
52+
53+
- name: Run node-gyp bug workaround script
54+
run: |
55+
bash .evergreen/node-gyp-bug-workaround.sh
5356
5457
- name: Install Dependencies
5558
run: |

.github/workflows/connectivity-tests.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ jobs:
7979
- name: Install [email protected]
8080
run: |
8181
npm install -g [email protected]
82-
npx --yes rimraf $LOCALAPPDATA/node-gyp/Cache || true
82+
83+
- name: Run node-gyp bug workaround script
84+
run: |
85+
bash .evergreen/node-gyp-bug-workaround.sh
8386
8487
- name: Install Dependencies
8588
run: |

0 commit comments

Comments
 (0)