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-5159 Specify content repo and parser version in build script for Netlify Frontend Builds #1309

Merged
merged 31 commits into from
Nov 22, 2024

Conversation

anabellabuckvar
Copy link
Collaborator

@anabellabuckvar anabellabuckvar commented Nov 20, 2024

Stories/Links:

DOP-5159: Specify Content Repo and Parser version for Frontend Netlify builds

Current Behavior:

Currently, the frontend only builds the master branch of docs-landing unless the build script itself is changed.
Current netlify.toml
Current build script
docs-frontend-stg build
docs-frontend-dotcomstg build

Notes:

This PR updates the build script for Netlify builds, but will not have any effect on autobuilder builds. It allows for controlling the repo, repo branch, and parser version used for the Netlify build through environment variables, thus making it easier for DOP engineers to stage different repos in Netlify and laying the groundwork for fully functional Slack deploys.
I've updated the Netlify.toml, defining environment variables for each of the four variables the build script needs, ORG_NAME REPO_NAME, BRANCH_NAME, PARSER_VERSION, and then passing those as arguments to the build script. I then updated the build script accordingly to read in those four arguments and use them for cloning the specified content repo, checking out the specified branch, and downloading the specified parser version.
Note: If these environment variables are set in both the Netlify.toml and the Netlify UI, the values in the Toml will override the UI values.

README updates

    • This PR introduces changes that should be reflected in the README, and I have made those updates.
    • This PR does not introduce changes that should be reflected in the README

Copy link

netlify bot commented Nov 20, 2024

Deploy Preview for docs-frontend-stg ready!

Name Link
🔨 Latest commit 50ff0e7
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-stg/deploys/6740c8b30ab6fe000889dd81
😎 Deploy Preview https://deploy-preview-1309--docs-frontend-stg.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.

Copy link

netlify bot commented Nov 20, 2024

Deploy Preview for docs-frontend-dotcomprd ready!

Name Link
🔨 Latest commit 50ff0e7
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-dotcomprd/deploys/6740c8b3d1172d0008300e3e
😎 Deploy Preview https://deploy-preview-1309--docs-frontend-dotcomprd.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.

Copy link

netlify bot commented Nov 20, 2024

Deploy Preview for docs-frontend-dotcomstg failed. Why did it fail? →

Name Link
🔨 Latest commit 50ff0e7
🔍 Latest deploy log https://app.netlify.com/sites/docs-frontend-dotcomstg/deploys/6740c8b337e17c00082dbea8

Copy link
Collaborator

@mmeigs mmeigs left a comment

Choose a reason for hiding this comment

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

Looks good! Just one question

Comment on lines +2 to +5
TESTING_ORGANIZATION=$1 # name of org, usually mongodb or 10gen
TESTING_REPO_NAME=$2 # name of content repo
TESTING_BRANCH_NAME=$3 # name of the branch
PARSER_VERSION=$4 # version of the parser to download
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to throw an error immediately if any of these are empty/undefined? Or do we want to have a fallback for the PARSER_VERSION and the TESTING_BRANCH_NAME? ie "latest" and "master"

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 for fallback defaults for these

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can set the fallback for these values as environment variables in the UI, or throw an error if they're undefined in the toml. Which do you think is the better way to go @seungpark @mmeigs

Copy link
Collaborator

Choose a reason for hiding this comment

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

i feel like directly in the toml as fallbacks might be good to keep it clear !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry I'm not clear on what that would look like, would you mind elaborating? How is what you are suggesting different than what is currently in the toml?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, i meant directly in this shell script** but in the toml is fine. in the case we want to deploy multiple previews, is that possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, I believe Netlify only really supports one deploy preview per build, but I'll brainstorm more

Copy link
Collaborator

@seungpark seungpark left a comment

Choose a reason for hiding this comment

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

minor note on default values but overall looks good

Comment on lines +2 to +5
TESTING_ORGANIZATION=$1 # name of org, usually mongodb or 10gen
TESTING_REPO_NAME=$2 # name of content repo
TESTING_BRANCH_NAME=$3 # name of the branch
PARSER_VERSION=$4 # version of the parser to download
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 for fallback defaults for these

README.md Show resolved Hide resolved
@anabellabuckvar anabellabuckvar changed the title DOP-5159 logging in build script DOP-5159 Specify content repo and parser version in build script for Netlify Frontend Builds Nov 21, 2024
command = ". ./build.sh $ORG_NAME $REPO_NAME $BRANCH_NAME $PARSER_VERSION"

[build.environment]
ORG_NAME = "mongodb"
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we only testing docs-landing for now, or can we build all content sites with this change right away. Out of curiosity, which ones have we already tested for ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All of them should be able to be built! I've tested landing, docs-cpp, and docs-relational-migrator so far

@anabellabuckvar anabellabuckvar merged commit 474dab5 into main Nov 22, 2024
10 of 14 checks passed
@anabellabuckvar anabellabuckvar deleted the DOP-5159 branch November 22, 2024 18:30
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.

4 participants