website icon indicating copy to clipboard operation
website copied to clipboard

Netlify build command cleanup

Open chalin opened this issue 2 years ago • 7 comments

This PR contains suggested improvements to the site build scripts and config.

  • Simplifies the netlify.toml build commands by using the NPM scripts. E.g., the production build command goes from:
    cd themes/docsy && git submodule update -f --init && npm install && cd ../.. && hugo --gc --minify
    
    to more the more concise yet equivalent:
    npm run build:production
    
  • Factors out common env var in netlify.toml
  • Adds NPM scripts that simplify building and serving the site

/cc @nate-double-u

chalin avatar Nov 17 '23 10:11 chalin

@chalin: GitHub didn't allow me to request PR reviews from the following users: nate-double-u.

Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

This PR contains suggested improvements to the site build scripts and config.

  • Simplifies the netlify.toml build commands by using the NPM scripts. E.g., the production build command goes from:
cd themes/docsy && git submodule update -f --init && npm install && cd ../.. && hugo --gc --minify

to more the more concise yet equivalent:

npm run build:production
  • Factors out common env var in netlify.toml
  • Adds NPM scripts that simplify building and serving the site

/cc @nate-double-u

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

google-oss-prow[bot] avatar Nov 17 '23 10:11 google-oss-prow[bot]

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chalin Once this PR has been reviewed and has the lgtm label, please assign zijianjoy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

google-oss-prow[bot] avatar Nov 17 '23 10:11 google-oss-prow[bot]

Hi @chalin. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

google-oss-prow[bot] avatar Nov 17 '23 10:11 google-oss-prow[bot]

Anything left to be done here? /cc @thesuperzapper

chalin avatar Nov 29 '23 10:11 chalin

@chalin Also, all our PR/historical branches are getting indexed by Google, we should fix that at the same time as this PR.

The goals would be:

  1. The main www.kubeflow.org site should be indexed
  2. All PR deploy-preview-XXXX--competent-brattain-de2d6d.netlify.app should NOT be indexed
  3. All other v1-7-branch.kubeflow.org sites should be NOT be indexed:
    • (these are just CNAME records pointing to the branch domains like v1-7-branch--competent-brattain-de2d6d.netlify.app)

I believe your changes here achieve 2, because you are setting -e dev in the hugo command, and because this is not "production", docsy adds <meta> no index tags.

We need to be careful about 1. Are you 100% confident that not setting -e production or HUGO_ENV=production is safe?

To achieve 3, we could set the HUGO_ENV from [context.branch-deploy.environment] to dev, but it will probably propagate faster if we use a robots.txt disallow on those domains (otherwise, the <meta> tags will take until Google next indexes each page).

thesuperzapper avatar Dec 05 '23 21:12 thesuperzapper

I've created a separate issue to track the full extent of the indexing issue, since more work will need to be done outside of the scope of this PR:

  • #3645

chalin avatar Dec 05 '23 23:12 chalin

I believe your changes here achieve 2, because you are setting -e dev in the hugo command, and because this is not "production", docsy adds <meta> no index tags.

Correct.

We need to be careful about 1. Are you 100% confident that not setting -e production or HUGO_ENV=production is safe?

For reassurance, see https://discourse.gohugo.io/t/what-does-setting-hugo-env-to-production-do/24669/2. Also, since the site uses hugo.IsProduction, we're good.

To achieve 3, we could set the HUGO_ENV from [context.branch-deploy.environment] to dev, but it will probably propagate faster if we use a robots.txt disallow on those domains (otherwise, the <meta> tags will take until Google next indexes each page).

I'll answer this in #3645.

chalin avatar Dec 06 '23 00:12 chalin