-
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(ci): add individual publishing of packages MONGOSH-1871 #2289
base: main
Are you sure you want to change the base?
Conversation
879eb0f
to
40d6e71
Compare
f48cc5c
to
a2f246b
Compare
], | ||
"version": "0.0.0-dev.0" | ||
"packages": ["configs/*", "packages/*", "scripts/docker"], | ||
"version": "independent" |
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.
@addaleax I'm a bit unsure how to go about all this to the point where I can feel much confidence;
What I did here is
- remove lerna force publish
- use lerna independent mode
- add the bump script
I feel like this should hypothetically do the trick. maybe a couple more changes might be all we need.
I tried i.e. running npm run bump-packages
locally and I wonder if it is because of the fact that this PR itself technically changes all of the packages, we end up with a bunch of bumps; some reasonable others not so much.
I assume some of these packages we'd like to ignore right? And also some which we should keep at 0.0.0-dev.0
for our development?
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.
I assume some of these packages we'd like to ignore right? And also some which we should keep at 0.0.0-dev.0 for our development?
Well, the mongosh
and @mongosh/cli-repl
packages specifically should still be bumped as part of the process we have now, that can be by using the 0.0.0-dev.0
placeholders but I don't think that's a strict requirement here
], | ||
"version": "0.0.0-dev.0" | ||
"packages": ["configs/*", "packages/*", "scripts/docker"], | ||
"version": "independent" |
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.
I assume some of these packages we'd like to ignore right? And also some which we should keep at 0.0.0-dev.0 for our development?
Well, the mongosh
and @mongosh/cli-repl
packages specifically should still be bumped as part of the process we have now, that can be by using the 0.0.0-dev.0
placeholders but I don't think that's a strict requirement here
8c9c214
to
41bc10a
Compare
@addaleax Didn't get to spend too much time on this before my holiday with some VSCode and coverage test back and forths. Would be happy to jump back into it in a week but if it'd be better to finish this earlier, feel free to pick it up 🙂 I have some WIP files that I may polish up and push at a later time also though not sure how useful they are; will see. |
41bc10a
to
ad630dc
Compare
@@ -917,6 +917,9 @@ functions: | |||
{ | |||
export NODE_JS_VERSION=${node_js_version} | |||
source .evergreen/setup-env.sh | |||
npm run evergreen-release bump | |||
git add . | |||
git commit --no-allow-empty -m "chore(release): bump to prepare for mongosh release" |
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.
The idea here is that this will bump both "independent" and mongosh packages before the release draft and push it to main, so our branch is consistent with what we're releasing.
It might also make sense to only persist this after the release is published.
I am assuming this should work? Though not sure if the evergreen git setup has ability to push to main like this?
export const MONGOSH_RELEASE_PACKAGES = ['mongosh', '@mongosh/cli-repl']; | ||
|
||
/** Packages which always get ignored when doing a release or bump */ | ||
export const IGNORE_BUMP_PACKAGES = [ |
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.
ignoring these since these are private, unless it'd make sense to publish anyways?
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@mongosh/arg-parser", | |||
"version": "0.0.0-dev.0", | |||
"version": "2.3.7", |
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.
these were all set to 2.3.7 manually to get the current repository consistent with the latest release
@@ -31,7 +31,5 @@ npm run mark-ci-required-optional-dependencies | |||
# along with its types, but npm wouldn't try and compile the addon | |||
(npm ci && test -e node_modules/mongodb-client-encryption) || npm ci --ignore-scripts | |||
|
|||
npm run evergreen-release bump |
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.
unless I am misunderstanding something, I don't think this bump was necessary to get the dir-based packages installed for the sake of i.e. tests, etc..
It does seem like that this acted as a preliminary step for different CI runs but the idea going forward is that the repository will have the latest published version and only get bumped before releases and persist for future runs
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.
I will double check this as I did see some weird error with browser-repl tests that may be caused by this
uses: mongodb-js/devtools-shared/actions/setup-bot-token@main | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.DEVTOOLS_BOT_APP_ID }} |
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.
I think this should be already set for us?
"preinstall": "node scripts/sort-workspaces.js" | ||
"preinstall": "node scripts/sort-workspaces.js", | ||
"bump-packages": "npm run bump-packages --workspace @mongosh/build", | ||
"publish-packages": "lerna publish from-package --no-verify-access --no-push --no-git-tag-version --yes" |
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.
This is 1:1 same as compass, I assume should be fine here also with our lerna setup, unless there's some special option we should pass for mongosh packages.
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.
I know this is modeled after what we already have and I'm not opposed to merging it as-is. That being said, I'd prefer if we move to a different publishing model, where we run the publish packages workflow on the bump packages PR, merge that PR, and only then tag the versions on main. That way we would eliminate a case where we have versions committed in main that haven't been published due to a glitch somewhere.
Additionally, we should move the npm token to an environment secret, which will require approvals for the workflow to run.
Co-authored-by: Nikola Irinchev <[email protected]>
@nirinchev Agree, wanted to ask before expanding the scope but I think it'd be a lot nicer and cleaner with this setup. I can clean that up and the documentation |
This adds the ability to individually publish packages in mongosh. Also, notably, all packages's version inside package.json will now match the latest released version and update accordingly upon release.
Structure
Package Bumping
With this change, there are 2 types of package bumping depending on what package it is:
mongosh
and@mongosh/cli-repl
are bumped only at mongosh release and have their versions synced.This gets triggered only during a mongosh release.
All other packages are bumped independently of mongosh using
bump-packages
from monorepo-tools. Each package can have divergent versions as a result.This can be triggered anytime using GitHub actions which will create PR for bump package versions, merging of which will cause CI to publish the packages.
Individual Package Release
You can release an individual package by running a bump packages GitHub Action and merging the created PR.
mongosh Release
A mongosh release will cause both an npm package bump and a mongosh release bump before starting the release.