Skip to content

Commit 5694672

Browse files
authored
feat: package on Node.js 24 instead of 20 MONGOSH-3062 (#2622)
* feat: package on Node.js 24 instead of 20 * chore: Update the aws-sdk to the latest 2x (unmaintained) The depepdency to the aws-sdk 2 will be removed once we start using the MongoDB Node.js driver 7.0.0 * chore: Use --legacy-peer-deps with npm@11 and upgrade Lerna to 9.0.3 npm@11 handles peer dependencies differently, so when bootstrapping mongosh with Node.js 24 it breaks the package-lock.json for Node.js 20. This is an issue if we want to keep backwards compatiblity for some time, so we have to use --legacy-peer-deps. However, lerna 8x uses nx in a way it's incompatible with --legacy-peer-deps, which required upgrading to 9.0.3. * chore: Remove patches already merged upstream * chore: Fix run-if-package-requested.js for Node.js v24 It seems a change broke it and because Node.js 24 pipelines do not run by default it wasn't catched. * chore: Drop support for building in macos-11 Node.js 24 drops support for macos older than 13, as documented in: https://github.com/nodejs/node/blob/v24.12.0/BUILDING.md#platform-list * chore: Update windows distro to use windows-2022-large Windows-vsCurrent-small does not have the clang module for msbuild, so use a more modern one that does have it. This change mimicks what we've done in boxednode to have the Windows build working. * chore: Force GYP to use the correct Python installation It has to use 3.11 to avoid issues with _ctypes. * chore: Upgrade clang in osx machines * chore: Run tests also in Node.js 24 now We should be able to run all the tests in Node.js 24 and detect any outstanding issue that has to be fixed in code. Eventually, we will want to get rid of running the tests in Node.js 20 * chore: Update mongodb-crypt-library-version to a Node.js 24 compatible version * chore: Upgrade Amazon2 to the latest version with an updated toolchain * chore: Add memfd_create patch as we've done in our toolchain * chore: Fix tests where the Node.js repl prompt uses '|' * chore: revert unnecessary changes on distros and disable n20 * chore: Add the aws-sdk as a peer dependency As it's necessary for the build and the driver * chore: Add explicit dependency to aws-sdk/credential-providers * chore: Hoist buffer in package-lock.json With the change to npm@11, npm seems to hvae decided unhost buffer, which makes some tests fail. Here we are forcing buffer to be hoisted by doing: `npm install buffer && git reset -- package.json && npm install` In case in the future we see a similar issue, hoisting it manually seems to solve it. * chore: Fix issue with the change from '...' to '|' for unterminated outputs * chore: Update devtools-connect to the latest version * chore: Update macos-export-certificate-and-key for Node.js 24 support * chore: Compile in vcdev env for Windows * chore: Hoist macos-export-certificate-and-key * chore: Update system-ca and transitive deps to Node.js 24 * chore: Force updating mongodb-client-encryption to 7.0.0 It's the first version that supports Node.js 24 * chore: Update devtools-connect and proxy support * chore: Patch kerberos to make private fields non linkable * chore: Support delayed-template-parsing due to clang constrains * chore: Use latest 2022 version * chore: Remove patch for older compilers * chore: Do not enable ltcg by default on release builds * chore: Try to use the inherited vcdev * chore: Fix hoisting problem on mongodb-client-encryption We need a few overrides because we still depend on the 6.x branch of the driver, but we need to upgrade the client encryption to 7.x to support Node.js 24. * fix: Update oidc-plugin to latest version The latest version changes how we use spawn and avoids deprecation warnings. * chore: Allow runNpm to return the stdout on failures for specific commands Right now npm outdated exits with a non-zero status. We have some additional checks where, if the stderr is empty, we consider the command to be successful. However, npm prints warnings to stderr, so a successful command with a warning fails. For cases where we really don't care about the status code, like npm ls or npm outdated, we pass the lenient flag, that will tell runNpm to ignore the exitCode and return stdout either way. * chore: Use a smaller instance for signature verification * fix: Fix tests related to the Node.js 24 update. There is a bug in the Node.js REPL that we will need to fix upstream or with a patch whenever we compile Node.js, so unless it runs on a patched Node.js version, some tests will still fail. * chore: Remove error handling for history loading In Node.js 24, the REPL itself will shallow the error and print the error itself, so we don't need to catch the error anymore. * chore: Monkey-patch Node.js 24 if we detect the history rewrite bug In Node.js 24 there is a bug in the history handling where, in the event that an input fails, and the next works fine, the failed input is rewritten. This monkey-patch detects the issue and rewrites the internal history handler to ignore errors, as really don't care about them at this point. * chore: Typing error * chore: Fix tests that depend on Node.js 24 REPL formatting and behaviour * chore: Fix the rest of the tests that depend on formatting * chore: Fix dependencies with oktokit (< n24) * chore: Fix package-lock inconsistencies after the merge with main * chore: Remove duplicate keys * chore: Ensure that we test on windows pre-2022 * chore: Disable RHEL10 tests Enabling them depends on DEVPROD-27117 * fix: Drop support for macos-11 hosts * chore: Run pkg_test_ssh on pre-2022 machines * chore: Compile in Sequoia but target Ventura Also, add e2e tests in Sequoia. * chore: Use GUI variants as we have a bigger pool * chore: Add macos-15 for distro uploadlist regex
1 parent aaf5689 commit 5694672

26 files changed

Lines changed: 2303 additions & 2397 deletions

.evergreen.yml

Lines changed: 1851 additions & 1848 deletions
Large diffs are not rendered by default.

.evergreen/build-variants/compile-build-variants.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ exports.COMPILE_BUILD_VARIANTS = [
6767
executableOsId: 'linux-s390x',
6868
},
6969
{
70-
displayName: 'MacOS Big Sur',
70+
displayName: 'MacOS 15 Sequoia (amd64)',
7171
id: 'darwin',
72-
runOn: 'macos-11',
72+
runOn: 'macos-15-amd64-gui',
7373
executableOsId: 'darwin-x64',
7474
},
7575
{
76-
displayName: 'MacOS Big Sur arm64',
77-
runOn: 'macos-11-arm64',
76+
displayName: 'MacOS 15 Sequoia (arm64)',
77+
runOn: 'macos-15-arm64-gui',
7878
executableOsId: 'darwin-arm64',
7979
},
8080
{
8181
id: 'win32',
8282
displayName: 'Windows VS 2022',
83-
runOn: 'windows-vsCurrent-large',
83+
runOn: 'windows-2022-latest-small',
8484
executableOsId: 'win32',
8585
},
8686
].map((buildVariant) => {

.evergreen/build-variants/e2e-tests-build-variants.js

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
9292
tags: ['nightly-driver'],
9393
executableOsId: 'linux-x64',
9494
mVersion: 'stable',
95+
disabled: true,
9596
},
9697
{
9798
displayName: 'RHEL 10 x64',
@@ -100,6 +101,7 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
100101
sharedOpenSsl: 'openssl3',
101102
executableOsId: 'linux-x64-openssl3',
102103
mVersion: 'stable',
104+
disabled: true,
103105
},
104106
{
105107
displayName: 'Ubuntu 18.04 x64',
@@ -319,6 +321,7 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
319321
tags: ['nightly-driver'],
320322
executableOsId: 'linux-arm64',
321323
mVersion: 'stable',
324+
disabled: true,
322325
},
323326
{
324327
displayName: 'RHEL 10 arm64',
@@ -327,6 +330,7 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
327330
sharedOpenSsl: 'openssl3',
328331
executableOsId: 'linux-arm64-openssl3',
329332
mVersion: 'stable',
333+
disabled: true,
330334
},
331335
{
332336
displayName: 'RHEL 8 PPC',
@@ -370,6 +374,24 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
370374
executableOsId: 'linux-s390x',
371375
mVersion: '8.2.x',
372376
},
377+
{
378+
displayName: 'MacOS 15 Sequoia (amd64)',
379+
runOn: 'macos-15-amd64-gui',
380+
executableOsId: 'darwin-x64',
381+
mVersion: 'stable',
382+
},
383+
{
384+
displayName: 'MacOS 15 Sequoia (arm64)',
385+
runOn: 'macos-15-arm64-gui',
386+
executableOsId: 'darwin-arm64',
387+
mVersion: 'stable',
388+
},
389+
{
390+
displayName: 'MacOS 15 Sequoia (arm64)',
391+
runOn: 'macos-15-arm64-gui',
392+
executableOsId: 'darwin-arm64',
393+
mVersion: '8.2.x',
394+
},
373395
{
374396
displayName: 'MacOS 14 x64',
375397
runOn: 'macos-14',
@@ -391,13 +413,13 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
391413
{
392414
displayName: 'MacOS Big Sur',
393415
id: 'darwin',
394-
runOn: 'macos-11',
416+
runOn: 'macos-13',
395417
executableOsId: 'darwin-x64',
396418
mVersion: '8.0.5',
397419
},
398420
{
399421
displayName: 'MacOS Big Sur arm64',
400-
runOn: 'macos-11-arm64',
422+
runOn: 'macos-13-arm64',
401423
id: 'darwin_arm64',
402424
executableOsId: 'darwin-arm64',
403425
mVersion: '8.0.5',
@@ -409,7 +431,7 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
409431
],
410432
},
411433
{
412-
displayName: 'Windows VS 2022',
434+
displayName: 'Windows VS PRE-2022',
413435
runOn: 'windows-vsCurrent-small',
414436
executableOsId: 'win32',
415437
mVersion: 'stable',
@@ -419,12 +441,29 @@ exports.E2E_TESTS_BUILD_VARIANTS = [
419441
],
420442
},
421443
{
422-
displayName: 'Windows VS 2022',
444+
displayName: 'Windows VS PRE-2022',
423445
runOn: 'windows-vsCurrent-small',
424446
executableOsId: 'win32',
425447
mVersion: '8.2.x'
426448
},
427-
].map((buildVariant) => {
449+
{
450+
displayName: 'Windows VS 2022',
451+
runOn: 'windows-2022-latest-small',
452+
executableOsId: 'win32',
453+
mVersion: 'stable',
454+
additionalTasks: [
455+
'package_artifact_win32_x64',
456+
'package_artifact_win32msi_x64',
457+
],
458+
},
459+
{
460+
displayName: 'Windows VS 2022',
461+
runOn: 'windows-2022-latest-small',
462+
executableOsId: 'win32',
463+
mVersion: '8.2.x'
464+
},
465+
].filter(({ disabled }) => disabled !== true)
466+
.map((buildVariant) => {
428467
const { displayName, fips, sharedOpenSsl, mVersion, runOn, executableOsId } =
429468
buildVariant;
430469
let id = (buildVariant.id ?? runOn ?? executableOsId).replaceAll('-', '_');

.evergreen/compilation-context-expansions.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
export DISTRO_UPLOADLIST_REGEX="^(rhel70|win|rhel7-zseries|rhel8-power|amazon2-arm64|macos)"
1+
export DISTRO_UPLOADLIST_REGEX="^(rhel70|win|rhel7-zseries|rhel8-power|amazon2-arm64|macos-12|macos-13|macos-14|macos-15)"
22
export COMPILING_CONTEXT_FILE="$(pwd)/../tmp/compiling-context.yml"
3+
mkdir -p $(dirname $COMPILING_CONTEXT_FILE)
34

45
if ! [[ "$DISTRO_ID" =~ $DISTRO_UPLOADLIST_REGEX ]]; then
56
echo "'$DISTRO_ID' will be disabled as it is not part of the DISTRO_UPLOADLIST_REGEX '$DISTRO_UPLOADLIST_REGEX'."

.evergreen/compilation-context-expansions.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ amazon2-arm64-large=true
2020
amazon2-large=false
2121
debian10-small=false
2222
debian11-small=false
23-
macos-11=true
24-
macos-11-arm64=true
23+
macos-11=false
24+
macos-11-arm64=false
2525
macos-13-arm64=true
2626
rhel70-build=true
2727
rhel70-large=true

.evergreen/compile-artifact.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export TMP=/tmp/m
2323
export TMPDIR=/tmp/m
2424

2525
if [ $(uname) = Darwin ]; then
26-
# match what Node.js 20 does on their own builder machines
27-
export CFLAGS='-mmacosx-version-min=10.15'
28-
export CXXFLAGS='-mmacosx-version-min=10.15'
29-
export MACOSX_DEPLOYMENT_TARGET=10.15
26+
# match what Node.js 24 does on their own builder machines
27+
export CFLAGS='-mmacosx-version-min=13.5'
28+
export CXXFLAGS='-mmacosx-version-min=13.5'
29+
export MACOSX_DEPLOYMENT_TARGET=13.5
3030
fi
3131

3232
# The CI machines we have for Windows and x64 macOS are not

.evergreen/constants.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.platformToDetails = {
1616
},
1717
win32: {
1818
displayName: 'Windows',
19-
runOn: 'windows-vsCurrent-small',
19+
runOn: 'windows-2022-small',
2020
executableOsId: 'win32',
2121
},
2222
};
@@ -50,12 +50,12 @@ exports.NODE_VERSIONS = [
5050
shortName: '20',
5151
versionSpec: NODE_JS_VERSION_20,
5252
skipNodeVersionCheck: '',
53-
optional: false,
53+
optional: true,
5454
},
5555
{
5656
shortName: '24',
5757
versionSpec: NODE_JS_VERSION_24,
5858
skipNodeVersionCheck: '',
59-
optional: true,
59+
optional: false,
6060
},
6161
];

0 commit comments

Comments
 (0)