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

feat: add support for fetching a greeting CTA as part of the update flow MONGOSH-1897 #2254

Merged
merged 11 commits into from
Feb 12, 2025

Conversation

nirinchev
Copy link
Contributor

@nirinchev nirinchev commented Nov 6, 2024

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:

 {
   "version": [
     {
       "version": "1.2.3",
       "downloads": [ ... ],
+      "cta": {
+        "chunks": [
+          { "text": "Fill out our survey ", "style": "bold" }
+          { "text": "https://mongodb.com/survey", "style": "mongosh:uri" }
+        ]
+      }
     }
   ]
 }

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:

 {
     "updateURL": "https://downloads.mongodb.com/compass/mongosh.json",
     "lastChecked": 1730881696340,
     "etag": "\"7f84f631518c4872e3e469c765d1eb03\"",
     "latestKnownMongoshVersion": "1.2.3",
+    "cta": {
+        "1.2.3-alpha.1": {
+           "chunks": [
+                { "text": "This is an alpha version! Use with caution!", "style": "bold" }
+            ]
+        },
+        "1.2.3": {
+           "chunks": [
+                { "text": "This is a stable version and very reliable!", "style": "bold" }
+            ]
+        },
+    }
 }

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.

* 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)
  ...
@nirinchev nirinchev requested review from addaleax and gagik January 9, 2025 14:38
@nirinchev
Copy link
Contributor Author

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.

@nirinchev nirinchev marked this pull request as ready for review January 9, 2025 14:41
@nirinchev nirinchev requested review from gagik and addaleax February 6, 2025 14:13
@nirinchev
Copy link
Contributor Author

@addaleax and @gagik, pinging you for another review as I had to rework nontrivially how the CTA config is read, because I realized we also needed it when publishing new mongosh versions. Now it's a simple json with an attached json schema that is properly validated at publishing time. All the fun changes are in b1fb4f8 (#2254), but feel free to take another look at the whole thing as it's been a while 😄

I feel fairly confident this is now correct and ready for merging.

@nirinchev
Copy link
Contributor Author

Evergreen failures point to issues that exist on main, so going to go ahead and merge this.

@nirinchev nirinchev merged commit 80fc072 into main Feb 12, 2025
131 of 134 checks passed
@nirinchev nirinchev deleted the ni/cta branch February 12, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants