Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: drop node 16 and add node 22 to CI matrix MONGOSH-1898 #2255

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
2,642 changes: 1,321 additions & 1,321 deletions .evergreen.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .evergreen/InstallNode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Get-ChildItem -Path $PSScriptRoot
Set-Location -Path $node_dir
Remove-Item .\npm
Remove-Item .\npm.cmd
if (Test-Path .\npm.ps1) { Remove-Item .\npm.ps1 }
Remove-Item .\npx
Remove-Item .\npx.cmd
if (Test-Path .\npx.ps1) { Remove-Item .\npx.ps1 }
Move-Item .\node_modules\npm -Destination .\node_modules\npm2
.\node.exe .\node_modules\npm2\bin\npm-cli.js i -g npm@6
6 changes: 3 additions & 3 deletions .evergreen/evergreen.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require('path');

const NODE_JS_VERSION_20 = require('./node-20-latest.json').version;
const NODE_JS_VERSION_16 = require('./node-16-latest.json').version;
const NODE_JS_VERSION_22 = require('./node-22-latest.json').version;

const MONGODB_VERSIONS = [
{ shortName: '42xc', versionSpec: '4.2.x' },
Expand All @@ -21,7 +21,7 @@ const MONGODB_VERSIONS = [
];
const NODE_VERSIONS = [
{ shortName: '20', versionSpec: NODE_JS_VERSION_20, skipNodeVersionCheck: '' },
{ shortName: '16', versionSpec: NODE_JS_VERSION_16, skipNodeVersionCheck: '' }
{ shortName: '22', versionSpec: NODE_JS_VERSION_22, skipNodeVersionCheck: '' }
];

const pathToPackages = path.join(__dirname, '..', 'packages');
Expand Down Expand Up @@ -1108,7 +1108,7 @@ tasks:

###
# UNIT TESTS
# E.g. test_m60xc_n16 stands for mongod 6.0.x, community edition, Node.js 16
# E.g. test_m60xc_n20 stands for mongod 6.0.x, community edition, Node.js 20
###
<% for (const { id, nShort, nVersion, mShort, mVersion, skipNodeVersionCheck, packageName } of ALL_UNIT_TESTS) { %>
- name: test_<% out(id) %>
Expand Down
6 changes: 1 addition & 5 deletions .evergreen/install-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ set -e
set -x
export BASEDIR="$PWD/.evergreen"

if echo $NODE_JS_VERSION | grep -q ^16 ; then
NPM_VERSION=9.9.2 # 9.9.3 does not install well on Windows
else
NPM_VERSION=10.8.3 # 10.9.0 does not install well on Windows
fi
NPM_VERSION=10.8.3 # 10.9.0 does not install well on Windows

if [ "$OS" == "Windows_NT" ]; then
powershell "$(cygpath -w "$BASEDIR")"/InstallNode.ps1
Expand Down
43 changes: 0 additions & 43 deletions .evergreen/node-16-latest.json

This file was deleted.

45 changes: 45 additions & 0 deletions .evergreen/node-22-latest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": "22.11.0",
"major": 22,
"minor": 11,
"patch": 0,
"tag": "",
"codename": "jod",
"versionName": "v22",
"start": "2024-04-24T00:00:00.000Z",
"lts": "2024-10-29T00:00:00.000Z",
"maintenance": "2025-10-21T00:00:00.000Z",
"end": "2027-04-30T00:00:00.000Z",
"releaseDate": "2024-10-29T00:00:00.000Z",
"isLts": true,
"files": [
"aix-ppc64",
"headers",
"linux-arm64",
"linux-armv7l",
"linux-ppc64le",
"linux-s390x",
"linux-x64",
"osx-arm64-tar",
"osx-x64-pkg",
"osx-x64-tar",
"src",
"win-arm64-7z",
"win-arm64-zip",
"win-x64-7z",
"win-x64-exe",
"win-x64-msi",
"win-x64-zip",
"win-x86-7z",
"win-x86-exe",
"win-x86-msi",
"win-x86-zip"
],
"dependencies": {
"npm": "10.9.0",
"v8": "12.4.254.21",
"uv": "1.48.0",
"zlib": "1.3.0.1-motley",
"openssl": "3.0.15+quic"
}
}
10 changes: 5 additions & 5 deletions .github/workflows/cron-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

# this is important so git log can pick up on
# the whole history to generate the list of AUTHORS
fetch-depth: '0'
fetch-depth: "0"

- name: Set up Git
run: |
Expand All @@ -29,12 +29,12 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: ^16.x
cache: 'npm'
node-version: ^20.x
cache: "npm"

- name: Install npm@8
run: |
npm install -g npm@8
npm install -g npm@10

- name: Install Dependencies and Compile
run: |
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
with:
commit-message: Update auto-generated files
branch: ci/cron-tasks-update-files
title: 'chore: update auto-generated files'
title: "chore: update auto-generated files"
body: |
- Update auto-generated files

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/update-node-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

# this is important so git log can pick up on
# the whole history to generate the list of AUTHORS
fetch-depth: '0'
fetch-depth: "0"

- name: Setup git
run: |
Expand All @@ -27,12 +27,12 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
node-version: 20.x
cache: "npm"

- name: Install npm@8.19.4
- name: Install npm@10
run: |
npm install -g npm@8.19.4
npm install -g npm@10

- name: Bump packages
run: |
Expand All @@ -46,8 +46,8 @@ jobs:
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: update node.js'
commit-message: "chore: update node.js"
branch: ci/update-node-js-versions
title: 'chore: update node.js'
title: "chore: update node.js"
body: |
- Update node.js
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"create-purls-file": "node scripts/create-purls.js .sbom/dependencies.json .sbom/node-js-dep.json > .sbom/purls.txt",
"preupdate-third-party-notices": "npm run create-dependency-sbom-lists",
"update-third-party-notices": "mongodb-sbom-tools generate-3rd-party-notices --product='mongosh' --dependencies=.sbom/dependencies.json > THIRD_PARTY_NOTICES.md",
"update-node-js-versions": "npx @pkgjs/nv ls v20 > .evergreen/node-20-latest.json && npx @pkgjs/nv ls v16 > .evergreen/node-16-latest.json",
"update-node-js-versions": "npx @pkgjs/nv ls v20 > .evergreen/node-20-latest.json && npx @pkgjs/nv ls v22 > .evergreen/node-22-latest.json",
"update-evergreen-config": "npm run test-evergreen-expansions && node .evergreen/generate-evergreen-yml.js .evergreen/evergreen.yml.in > .evergreen.yml",
"update-cli-usage-text": "node scripts/update-cli-usage-text.js",
"update-security-test-summary": "ts-node scripts/generate-security-test-summary.ts > docs/security-test-summary.md",
Expand Down Expand Up @@ -131,7 +131,8 @@
"webpack-cli": "^4.3.1",
"which": "^2.0.2",
"yaml": "^1.10.0",
"depcheck": "^1.4.7"
"depcheck": "^1.4.7",
"@pkgjs/nv": "^0.2.2"
},
"optionalDependencies": {
"lerna": "^8.1.8"
Expand Down
5 changes: 5 additions & 0 deletions packages/e2e-tests/test/e2e-auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
skipIfApiStrict,
startSharedTestServer,
} from '../../../testing/integration-testing-hooks';
import { skipDueToEPermErrors } from './util-helpers';

type AssertUserExists = (opts?: Document, username?: string) => Promise<void>;
function createAssertUserExists(db: Db, dbName: string): AssertUserExists {
Expand Down Expand Up @@ -1053,6 +1054,8 @@ describe('Auth e2e', function () {
shell.assertNoErrors();
});
it('cannot auth when authenticationMechanism mismatches (sha256 -> sha1)', async function () {
skipDueToEPermErrors(this);

const connectionString = await testServer.connectionString();
shell = this.startTestShell({
args: [
Expand All @@ -1074,6 +1077,8 @@ describe('Auth e2e', function () {
});
});
it('cannot auth when authenticationMechanism mismatches (sha1 -> sha256)', async function () {
skipDueToEPermErrors(this);

const connectionString = await testServer.connectionString();
shell = this.startTestShell({
args: [
Expand Down
5 changes: 4 additions & 1 deletion packages/e2e-tests/test/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { createServer as createHTTPServer } from 'http';
import { once } from 'events';
import type { AddressInfo } from 'net';
const { EJSON } = bson;
import { sleep } from './util-helpers';
import { skipDueToEPermErrors, sleep } from './util-helpers';

const jsContextFlagCombinations: `--jsContext=${'plain-vm' | 'repl'}`[][] = [
[],
Expand Down Expand Up @@ -1046,6 +1046,8 @@ describe('e2e', function () {
});

it('reads and runs code from stdin, with .end()', async function () {
skipDueToEPermErrors(this);

const dbName = `test-${Date.now()}`;
shell.process.stdin.end(`
use ${dbName};
Expand All @@ -1059,6 +1061,7 @@ describe('e2e', function () {
});

it('reads and runs the vscode extension example playground', async function () {
skipDueToEPermErrors(this);
createReadStream(
path.resolve(__dirname, 'fixtures', 'exampleplayground.js')
).pipe(shell.process.stdin);
Expand Down
7 changes: 7 additions & 0 deletions packages/e2e-tests/test/util-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}

export function skipDueToEPermErrors(context: Mocha.Context): void {
if (process.platform === 'win32' && process.versions.node.startsWith('22')) {
// This test fails on Windows with node 22 likely due to https://github.com/nodejs/node/issues/51766
return context.skip();
}
}
Loading