Skip to content

Commit

Permalink
chore(NODE-6622): pin npm version for node 18 to 10 (#4358)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Dec 17, 2024
1 parent f6d7868 commit e972bb8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .evergreen/ci_matrix_constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const MONGODB_VERSIONS = ['latest', 'rapid', '8.0', '7.0', '6.0', '5.0', '4.4', '4.2', '4.0'];
const versions = [
{ codeName: 'gallium', versionNumber: 16, npmVersion: 9 },
{ codeName: 'hydrogen', versionNumber: 18, npmVersion: 'latest' },
{ codeName: 'hydrogen', versionNumber: 18, npmVersion: 10 },
{ codeName: 'iron', versionNumber: 20, npmVersion: 'latest' },
{ codeName: 'jod', versionNumber: 22, npmVersion: 'latest' },
];
Expand Down
6 changes: 3 additions & 3 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3581,7 +3581,7 @@ tasks:
params:
updates:
- {key: NODE_LTS_VERSION, value: '18'}
- {key: NPM_VERSION, value: latest}
- {key: NPM_VERSION, value: '10'}
- func: install dependencies
- func: run unit tests
- name: run-unit-tests-node-20
Expand Down Expand Up @@ -4842,7 +4842,7 @@ buildvariants:
run_on: rhel80-large
expansions:
NODE_LTS_VERSION: 18
NPM_VERSION: latest
NPM_VERSION: 10
CLIENT_ENCRYPTION: true
tasks:
- test-latest-server
Expand Down Expand Up @@ -5123,7 +5123,7 @@ buildvariants:
run_on: windows-vsCurrent-large
expansions:
NODE_LTS_VERSION: 18
NPM_VERSION: latest
NPM_VERSION: 10
tasks:
- test-latest-server
- test-latest-replica_set
Expand Down
3 changes: 2 additions & 1 deletion .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ for (const {
const nodeLtsDisplayName = `Node${NODE_LTS_VERSION}`;
const name = `${osName}-${NODE_LTS_VERSION >= 20 ? nodeLtsDisplayName : nodeLTSCodeName}`;
const display_name = `${osDisplayName} ${nodeLtsDisplayName}`;
const expansions = { NODE_LTS_VERSION, NPM_VERSION: NODE_LTS_VERSION === 16 ? 9 : 'latest' };
const NPM_VERSION = versions.find(({versionNumber}) => versionNumber === NODE_LTS_VERSION).npmVersion;
const expansions = { NODE_LTS_VERSION, NPM_VERSION };
const taskNames = tasks.map(({ name }) => name);

if (clientEncryption) {
Expand Down
5 changes: 4 additions & 1 deletion .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ export NODE_LTS_VERSION=${NODE_LTS_VERSION:-16}
# npm version can be defined in the environment for cases where we need to install
# a version lower than latest to support EOL Node versions.

# If NODE_LTS_VERSION is numeric and less than 18, default to 9. Do not override if it is already set.
# If NODE_LTS_VERSION is numeric and less than 18, default to 9, if less than 20, default to 10.
# Do not override if it is already set.
if [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 18 ]]; then
export NPM_VERSION=${NPM_VERSION:-9}
elif [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 20 ]]; then
export NPM_VERSION=${NPM_VERSION:-10}
else
export NPM_VERSION=${NPM_VERSION:-latest}
fi
Expand Down

0 comments on commit e972bb8

Please sign in to comment.