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

Version 0.8 - API integration #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Version 0.8 - API integration #25

wants to merge 8 commits into from

Conversation

tomdyson
Copy link
Owner

This is a larger than usual update, with backwards-incompatible changes.

  • the Deployment model has been removed, in favour of direct integration with the Netlify API
  • a new view for Wagtail administrators lists the recent builds, with the option of triggering new builds
  • support for Wagtail < 2 has been removed.

Copy link
Collaborator

@loicteixeira loicteixeira left a comment

Choose a reason for hiding this comment

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

I didn't get to run it locally just yet but keen on doing so before the end of the week if you're not in a hurry to merge.

FWIW, this implementation won't be compatible with multi-sites builds (unless they are served as sub-folders on a same domain), but I don't think the old way was compatible either and, to be honest, multi-sites builds are rather niche and a bit flaky with wagtail-bakery so there are some upstream work to do before we can worry of that ourselves.


API_ROOT = "https://api.netlify.com/api/v1/"
HEADERS = {
"Authorization": str("Bearer " + settings.NETLIFY_API_TOKEN),
Copy link
Collaborator

@loicteixeira loicteixeira Dec 2, 2020

Choose a reason for hiding this comment

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

Why is there a cast to str here? If the fear is that settings.NETLIFY_API_TOKEN isn't a string already, then it would still fail because the concatenation would have happened already and failed with a ValueError. The cast to str should be around settings.NETLIFY_API_TOKEN, or it could use an f-string which would do the casting automatically.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, NETLIFY_API_TOKEN being an optional parameter, we should account for that and raise an error for trying to use the API without authentication, giving a clear indication of the error rather than having to parse Netlify's response.

This also applies to NETLIFY_SITE_ID in get_site_name and netlify_deploys below.

@loicteixeira
Copy link
Collaborator

I didn't get to run it locally just yet but keen on doing so before the end of the week if you're not in a hurry to merge.

That didn't age well. I'm not sure when I'll have time to look it up again so don't let me stop you from merging.

Copy link

@Qoyyuum Qoyyuum left a comment

Choose a reason for hiding this comment

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

So far it looks OK as it is. @tomdyson could address @loicteixeira and my comments before approving this PR.

"deploy",
"--dir={}".format(settings.BUILD_DIR),
"--prod",
'--message="Wagtail Deployment"',
Copy link

Choose a reason for hiding this comment

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

Why not add the deployment id here?

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