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

[DOP-5031]: Add persistence module functionality to script #9

Closed
wants to merge 8 commits into from

Conversation

branberry
Copy link
Collaborator

@branberry branberry commented Sep 26, 2024

Notes

Add the persistence module as a part of the Netlify builds. Another PR will be introduce shortly to add the command that calls the persistence module.

Apologies, ran the formatter + linter which produced a TON of changes. I've marked where the actual changes live as PR comments

Testing

Successfully ran locally with docs-node
image

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for search-manifest-integration canceled.

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/search-manifest-integration/deploys/66f708c5eda0b300087d0657

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for persistence-module-integration canceled.

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/persistence-module-integration/deploys/66f708c506a04e00083e8c15

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for site-links-display canceled.

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/site-links-display/deploys/66f708c5bd006a00087aa067

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for redoc-integration canceled.

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/redoc-integration/deploys/66f708c562aa360008ba8802

Copy link

netlify bot commented Sep 26, 2024

Deploy Preview for snooty-cache-plugin ready!

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/snooty-cache-plugin/deploys/66f708c5547b07000885e71a
😎 Deploy Preview https://deploy-preview-9--snooty-cache-plugin.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -0,0 +1,29 @@
import type { NetlifyPluginUtils } from '@netlify/build';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual change here


await checkForNewSnootyVersion(run);
},
await downloadPersistenceModule(run);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual change here

Copy link

netlify bot commented Sep 27, 2024

Deploy Preview for git-changed-files-plugin-bianca ready!

Name Link
🔨 Latest commit 7c94a4b
🔍 Latest deploy log https://app.netlify.com/sites/git-changed-files-plugin-bianca/deploys/66f708c5ef50ee0008fd7eb9
😎 Deploy Preview https://deploy-preview-9--git-changed-files-plugin-bianca.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@branberry branberry changed the title Persistence module code [DOP-5031]: Call persistence module in Netlify build script Sep 27, 2024
@branberry branberry marked this pull request as ready for review September 27, 2024 19:40
Copy link
Collaborator

@rayangler rayangler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of questions from me right now!

Also might be a nitpick but the PR title suggests we're calling the persistence module here, but PR description suggests that will be handled separately? Should we update the title to more accurately reflect the change?

I also see some linting errors in the CI, despite all of the linting changes in the PR 🤔 Might be out of scope, but would we ever want to make the linting CI with formatting a required check to ensure PRs don't have mass changes in the future?

if (isModuleDownloaded) return;

await run.command(
'git clone --depth 1 --filter=tree:0 https://github.com/mongodb/docs-worker-pool.git --sparse',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Questions)

  • Do we have plans to port over the persistence module directly to this repo in the future?
  • Is there a reason why we're downloading the persistence module from the Autobuilder repo while also having persistence-module code in this repo?

Copy link
Collaborator Author

@branberry branberry Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great questions!

For your first point, that was the original intention, but the one issue with porting it over as an integration is that we need the persistence module to run prior to building the Gatsby site.

I thought it would be easier to do so, but the order in which the integrations run make it difficult to do that since the build.sh script calls the parser and then calls the Gatsby site. The build integrations can essentially only be run before or after this point.

To answer your question, I think right now we don't have plans to port over all of the persistence module code at this time. This doesn't mean we shouldn't, though. One thing that caused this change of plans is that I'm unsure of how much will need to change with the logic in the persistence module with regards to some upcoming projects (I'll message you on Slack more on this).

For you second point, thank you for calling that out. There isn't a reason for that, and I'll make sure to remove the extra code 👍

Comment on lines +37 to +39
await downloadPersistenceModule(run);
} catch (e) {
console.error('Unable to run the persistence module', e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Nit) Is this function for downloading or for running the persistence module? Differences in the name of the function and error message are a bit confusing to me.

(Question) The context might be lost on me, but can you also please briefly remind me why the caching integration is responsible for calling the persistence module in this case? I thought this integration was responsible for caching parser data. Hoping to just learn more about this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Raymund! Really good point, and an oversight on my part. This should really just live in the persistence module integration instead of this one.

I'll move this code 👍

@branberry branberry changed the title [DOP-5031]: Call persistence module in Netlify build script [DOP-5031]: Add persistence module functionality to script Sep 30, 2024
@branberry
Copy link
Collaborator Author

@rayangler Thank you for the review! To your question of the formatting changes, I think it would be a good idea to do that. I actually ran the linter and formatter manually this time because this hasn't been run on the codebase yet. There are some other linting changes that couldn't manually be resolved automatically such as typing. Either way, these are formatting changes that are required, so I'll probably just run the same command and create a separate PR to make it more clear what's going on.

@branberry branberry closed this Sep 30, 2024
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.

2 participants