-
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
feat: add support for fetching a greeting CTA as part of the update flow MONGOSH-1897 #2254
base: main
Are you sure you want to change the base?
Conversation
* main: (34 commits) chore: update auto-generated files [skip actions] chore: update auto-generated files [skip actions] chore(ci): use github app tokens instead of bot user (#2282) chore: update auto-generated files [skip actions] chore(ci): cleanup auto generated file workflow MONGOSH-1927 (#2281) chore: update auto-generated files chore(ci): use a github app for the generated files credentials MONGOSH-1927 (#2280) chore(deps): bump driver, bson, oidc-plugin to latest MONGOSH-1916 (#2279) chore(ci): login to docker (#2277) chore(ci): don't download chrome for cron tasks (#2278) chore: update node.js (#2270) chore: push auto-generated files directly instead of using PRs (#2275) fix(ci): allocate more memory to fix test_vscode MONGOSH-1892 (#2239) chore: update auto-generated files (#2276) feat(shell-api): add options in stream processor start, stop, and drop MONGOSH-1920 (#2274) chore: update auto-generated files (#2273) chore: update auto-generated files (#2272) fix: include nonce in oidc request by default MONGOSH-1905 MONGOSH-1917 (#2269) chore(ci): filter for explictily set variants in unit tests (#2271) chore: update auto-generated files (#2268) ...
This is ready for review - I tested it with a custom S3 bucket and feel fairly confident that it works. The only remaining task is provisioning credentials for the downloads S3 bucket, adding them as a secret to GHA, and testing the workflow for updating the cta. Waiting on devprod there and I'll make sure to test it out before merging. |
@@ -93,6 +93,7 @@ module.exports = { | |||
...common.testRules, | |||
...extraJSRules, | |||
...extraTypescriptRules, | |||
'@typescript-eslint/no-non-null-assertion': 'off', |
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.
Just going to mention that I think that this is on almost everywhere in our repos and that hasn't been a major issue for the most part
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.
don't have strong feelings but agree
// eslint-disable-next-line no-non-null-assertion
or a forced type case i.e. ??? as unknown as ...
could be better for case by case?
jsonContents?.versions?.filter( | ||
(v) => v.version === this.latestKnownMongoshVersion | ||
)?.[0]?.cta ?? jsonContents?.cta; |
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.
jsonContents?.versions?.filter( | |
(v) => v.version === this.latestKnownMongoshVersion | |
)?.[0]?.cta ?? jsonContents?.cta; | |
jsonContents?.versions?.find( | |
(v) => v.version === this.latestKnownMongoshVersion | |
)?.cta ?? jsonContents?.cta; |
?.filter((v) => !semver.prerelease(v)) | ||
?.sort(semver.rcompare)?.[0]; | ||
|
||
this.currentVersionGreetingCTA = | ||
jsonContents?.versions?.filter((v) => v.version === currentVersion)?.[0] |
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.
jsonContents?.versions?.filter((v) => v.version === currentVersion)?.[0] | |
jsonContents?.versions?.find((v) => v.version === currentVersion) |
@@ -529,4 +532,225 @@ describe('DownloadCenter config', function () { | |||
expect(serverTargets).to.include(target); | |||
}); | |||
}); | |||
|
|||
describe('updateJsonFeedCTA', function () { | |||
let dlCenter: any; |
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.
very nit: also a sinon.SinonStub
?
This adds support for fetching a greeting CTA via the versions json. The proposed design adds support for reading a
cta
field in the version objects:These are optional and nothing will be displayed if they're not present. If they are present and the version matches the current version, we'll format the chunks with their corresponding styles and display the message as part of the greeting.
Additionally, we add the following to the
update-metadata.json
:The greeting CTA for the current version based on package.json will be picked, but locally we're saving both the current and the latest version's CTAs to make it readily available once the user upgrades.