-
Notifications
You must be signed in to change notification settings - Fork 67
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: add a config for running CI against the nightly driver MONGOSH-1473 #1780
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c0db900
add a config for running CI against the nightly driver
lerouxb 63b3f18
add comment linking to where I got this from
lerouxb 34e289c
log something
lerouxb 1b626f1
more intuitive name
lerouxb 3ccb900
update script comments and logging to reflect what it does
lerouxb 226503e
expand nightly to the exact version, force install
lerouxb cc99718
Update scripts/replace-package.js
lerouxb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# https://github.com/evergreen-ci/evergreen/blob/main/docs/Project-Configuration/Parameterized-Builds.md#project-config | ||
parameters: | ||
- key: mongodb_driver_version_override | ||
value: nightly | ||
|
||
include: | ||
- filename: .evergreen.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
// Replace a package with symlinks to a specific directory. | ||
// Example: | ||
// REPLACE_PACKAGE=mongodb:/home/src/node-mongodb-native node scripts/replace-package.js | ||
// will make 'mongodb' point to '/home/src/node-mongodb-native' in the root | ||
// directory and all lerna packages. | ||
// REPLACE_PACKAGE=mongodb:latest node scripts/replace-package.js | ||
// will replace the 'mongodb' dep's version with latest in the root directory | ||
// and all packages. | ||
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { pathToFileURL } = require('url'); | ||
const { execSync } = require('child_process'); | ||
|
||
const replacement = process.env.REPLACE_PACKAGE; | ||
if (!replacement) { | ||
|
@@ -17,19 +16,28 @@ if (!parsed || !parsed.groups.from || !parsed.groups.to) { | |
throw new Error('Invalid format for REPLACE_PACKAGE'); | ||
} | ||
|
||
const { from, to } = parsed.groups; | ||
function resolveTag(from, to) { | ||
return execSync(`npm dist-tag ls ${from}@${to} | awk -F ': ' '/^${to}/ {print \$2}'`).toString().trim(); | ||
lerouxb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
const { from, to: _to } = parsed.groups; | ||
|
||
// npm install doesn't seem to do anything if you're updating a | ||
// package-lock.json file that already has the dep to a tag like nightly, but it | ||
// does do something if you change it to the exact version. | ||
const to = _to === 'nightly' ? resolveTag(from, _to) : _to; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At this point you might as well just make the script driver-specific? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thought did cross my mind 😆 |
||
|
||
for (const dir of ['.', ...fs.readdirSync('packages').map(dir => path.join('packages', dir))]) { | ||
const packageJson = path.join(dir, 'package.json'); | ||
if (fs.existsSync(packageJson)) { | ||
const target = pathToFileURL(path.resolve(to)).href; | ||
const contents = JSON.parse(fs.readFileSync(packageJson)); | ||
for (const deps of [ | ||
contents.dependencies, | ||
contents.devDependencies, | ||
contents.optionalDependencies | ||
]) { | ||
if (deps && deps[from]) { | ||
console.info('Replacing', from, 'in', dir, 'with', target); | ||
console.info(`Replacing deps[${from}]: ${deps[from]} with ${to}`); | ||
deps[from] = to; | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the evergreen log:
That's not an actual file that exists, right? And
npm ls
still stays[email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good now.