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

bpo-37860: re-add netlify.toml to set up deploy previews for docs #92852

Merged
merged 9 commits into from
Dec 6, 2022

Conversation

epicfaace
Copy link
Contributor

Fixes #82041 by setting up Netlify to set up deploy previews for docs.

This PR re-does #15288. Reverts #30272 (where we had originally removed netlify.toml due to build limits). As per #82041 (comment), the build limits are now large enough that they should be fine to use for cpython.

@epicfaace
Copy link
Contributor Author

Do we need a NEWS label for this? I was thinking we could skip news?

@hugovk
Copy link
Member

hugovk commented May 16, 2022

Thanks for this!

I added the skip news label.

Please could you do a deploy to a demo site first to check the command still works three years later?

For example, Ubuntu Focal is now the default image, and the default Python is 3.8 (not 2.7) so may be able to skip Doc/runtime.txt altogether.

https://github.com/netlify/build-image/blob/focal/included_software.md

@epicfaace
Copy link
Contributor Author

@hugovk made some small fixes, it now deploys correctly. My branch is deployed at: https://steady-heliotrope-731cac.netlify.app/

@hugovk
Copy link
Member

hugovk commented May 16, 2022

Good work! Out of interest, how long does a single build/deploy take?

@epicfaace
Copy link
Contributor Author

It took 4m16s.

@hugovk
Copy link
Member

hugovk commented May 17, 2022

Thanks, so with 25,000 minutes per month, 4-5 minutes per build gives us 5,000-6,250 builds per month.

That's significantly better than the ~170/month estimate 2 years ago: #15288 (comment).

I see it's also possible to configure ignored builds, can we only build previews when there are changes in the Doc directory? That would save resources and make PR runs quicker/cleaner too.

https://docs.netlify.com/configure-builds/ignore-builds/

@epicfaace
Copy link
Contributor Author

epicfaace commented May 17, 2022

I see it's also possible to configure ignored builds, can we only build previews when there are changes in the Doc directory? That would save resources and make PR runs quicker/cleaner too.

https://docs.netlify.com/configure-builds/ignore-builds/

This is already configured by default. The link above says "Depending on your Branches settings, any time there is a change in a linked repository, Netlify tries to determine whether there are changes in the site’s base directory by comparing the last known version of the files in that directory."

The base directory is already set to Doc/.

@hugovk
Copy link
Member

hugovk commented May 17, 2022

Great, then I think we're all set!


@ewdurbin As a follow on to #15288 (comment) in 2019, we should now have 25k minutes per month (#82041 (comment)), and are ready to try this out again.

Please could you hook up the Netlify account? I would suggest we only run it on main to begin, and review usage after a few weeks/a month, and consider enabling it for 3.11 too (possibly even others).


If we have max 3 team members (#15288 (comment)), @Mariatta, you asked to be added in 2019 (#15288 (comment)), would you still like to?

And to further increase the bus factor, who would like to be the 3rd?

@epicfaace
Copy link
Contributor Author

I'm happy to be the third! If it's fine though I'm not a committer

@epicfaace
Copy link
Contributor Author

Also, looks like we're no longer limited to 3 team members max: see https://www.netlify.com/legal/open-source-policy/:

Our Open Source plan has the same features and limits as our Pro plan, with the addition of free unlimited team members.

@epicfaace
Copy link
Contributor Author

epicfaace commented May 17, 2022

Also, one more thing: I think to comply with the requirements mentioned in https://www.netlify.com/legal/open-source-policy/, we should add a Netlify badge / "This site is powered by Netlify" message on all deploy previews.

I don't think we need to / should add it to the main docs, but we can add it on deploy previews only -- for example, we could set an environment variable that then renders the Netlify badge only on deploy previews. I'm happy to implement if we're good with that approach. What do you think @hugovk ?

@hugovk
Copy link
Member

hugovk commented May 18, 2022

The env var approach sounds good to add it only to deploy previews. Perhaps the text link option, in the footer? And just on the homepage or all pages?

@Mariatta
Copy link
Member

Thanks for your work @epicface.

I think we need to display more prominently that the docs rendered is a "preview". So where-ever we put the netlify badge, we should add the "preview" info as well. Is that something we can do?

As comparison, on the devguide (built with readthedocs), the preview is displayed at the top of the page:

e.g: https://cpython-devguide--867.org.readthedocs.build/

Screen Shot 2022-05-18 at 10 30 25 AM

@AA-Turner
Copy link
Member

Adding a warning admonition to the top of the page seems a reasonable idea regardless, although the ephemeral nature of the previews (& non-canonical URL) should help to disambiguate d.p.o from the previews.

@hugovk from the linked Netifly page, it seems only the "main page" is required - so /index.html.

A

@hugovk
Copy link
Member

hugovk commented Jun 18, 2022

Hi again @epicfaace! Do you think you can make the above changes? Thanks!

@arhadthedev
Copy link
Member

I think the popup warning that collapses into the bottom will be more noticeable. Here is an example from tc39/ecma262:

image

image

@epicfaace
Copy link
Contributor Author

@epicfaace
Copy link
Contributor Author

epicfaace commented Jun 19, 2022

All right, this PR should be ready now, @Mariatta and @hugovk . I just added a simple banner for now that displays on top of all pages:

image

Sample deploy preview: https://62af84a185fcf70008d07339--steady-heliotrope-731cac.netlify.app/

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Thanks, a couple of comments!

Doc/tools/templates/layout.html Outdated Show resolved Hide resolved
Doc/tools/templates/layout.html Outdated Show resolved Hide resolved
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@hugovk
Copy link
Member

hugovk commented Jun 19, 2022

Om mobile, the top of the banner is hidden:

image

@epicfaace
Copy link
Contributor Author

Om mobile, the top of the banner is hidden:

Note that this banner uses the same styling as the "This document is for an old version of Python that is no longer supported" banner. The top of this banner will also be hidden once we start showing this banner on versions of the docs that have a responsive mobile layout. This means that when 3.8 reaches EOL (as 3.8 is the first version of the docs with a responsive mobile layout), we'll have a similar problem in which the top of the banner "This document is for an old version of Python that is no longer supported." will be hidden.

@epicfaace
Copy link
Contributor Author

to clarify -- 3.6 doesn't have this problem as it's not using a mobile responsive layout:

image

but 3.8 most certainly will, once we add the red banner.

image

@hugovk
Copy link
Member

hugovk commented Jun 19, 2022

Ah okay. So for the "no longer supported" it won't happen until 3.8 is EOL on 2024-10-14, but for the previews it will happen right away :)

We could report this to (I guess) https://github.com/python/python-docs-theme and come up with a fix later?

@epicfaace
Copy link
Contributor Author

@hugovk yes. It seems more involved to fix that issue so I've went ahead and reported it in python/python-docs-theme#95.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Thanks!

@hugovk
Copy link
Member

hugovk commented Jul 27, 2022

@ewdurbin Hi! Please could you hook up the Netlify account again?

See #92852 (comment)

And please add @Mariatta to the team. Thank you!

@encukou
Copy link
Member

encukou commented Aug 22, 2022

@ewdurbin Will you be able to do this, or is something blocking you?

@hugovk
Copy link
Member

hugovk commented Dec 6, 2022

Looks like we're all set now!

Here's a recent docs PR build:

And the corresponding preview:

Thank you Ee for setting up Netlify and Ashwin for this and the earlier PRs! 👏

@encukou
Copy link
Member

encukou commented Dec 6, 2022

The banner is missing, though.

@hugovk
Copy link
Member

hugovk commented Dec 6, 2022

I guess because that PR doesn't yet have the banner changes from this one.

@encukou Would you like to rebase/merge #100054 from main to test it?

@encukou
Copy link
Member

encukou commented Dec 6, 2022

You're right, with an up-to-date branch it works!

@Mariatta
Copy link
Member

Mariatta commented Dec 6, 2022

This is amazing! Thank you everyone for pushing through and thanks @epicfaace for this PR. This is a great help to all contributors here.

@epicfaace
Copy link
Contributor Author

Amazing, thank you all for reviewing and getting this in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add deploy preview for docs
8 participants