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

feat(providers): add netlify #1820

Merged
merged 18 commits into from
Nov 28, 2022
Merged

Conversation

SphericalKat
Copy link
Contributor

Closes #714

@SphericalKat SphericalKat force-pushed the master branch 3 times, most recently from fbb3be5 to 7b3402b Compare November 20, 2022 19:13
@tlimoncelli
Copy link
Contributor

Looks good so far!

Just FYI: It is normal for tests to fail as "unauthorized". Github won't provide API keys to PRs that come from outside.

Let me know when its ready for for review.

@SphericalKat
Copy link
Contributor Author

Hello, this is ready for review. Thanks!

@msfjarvis
Copy link

msfjarvis commented Nov 21, 2022

Found a couple issues while testing this out

  1. Netlify's NETLIFY and NETLIFYv6 records are not supported but definitely should be
  2. TXT records are currently broken, but that's a quick fix
diff --git providers/netlify/netlifyProvider.go providers/netlify/netlifyProvider.go
index 2752274fd229..4bdfb6580965 100644
--- providers/netlify/netlifyProvider.go
+++ providers/netlify/netlifyProvider.go
@@ -116,7 +116,7 @@ func (n *netlifyProvider) GetZoneRecords(domain string) (models.Records, error)
 			}
 			err = rec.SetTargetSRV(uint16(r.Priority), r.Weight, r.Port, r.Value)
 		case "TXT":
-			err = rec.SetTargetTXTfromRFC1035Quoted(r.Value)
+			err = rec.SetTargetTXT(r.Value)
 		case "CAA":
 			err = rec.SetTargetCAA(uint8(r.Flag), r.Tag, r.Value)
 		default:

@SphericalKat
Copy link
Contributor Author

Thanks for the report @msfjarvis, working on these issues.

@SphericalKat
Copy link
Contributor Author

SphericalKat commented Nov 22, 2022

Hello, I've been working with @msfjarvis to fix the issues he reported. The TXT records issue has been fixed, but NETLIFY records seem to be rather painful. Through a bit of experimentation, it's clear that the Netlify API does not allow for manual creation of these records.

One option is just to transparently ignore them, but I'm open to other suggestions. Your advice would be very welcome @tlimoncelli 😄

@tlimoncelli
Copy link
Contributor

I concur. Let's break this into 2 merges. The first will ignore NETLIFY records. Then work out how to handle them in a second merge.

@abovedave
Copy link

It seems like NETLIFY records are special in the sense they are created/updated at the site level within the Netlify UI (for features like branch subdomains).

Perhaps it's worth exploring the updateSite endpoint?

@msfjarvis
Copy link

Likely unsuitable to be merged into the PR, but with this diff applied I've been able to use IGNORE_NAME to suppress the unwanted deletion of the NETLIFY records.

D('msfjarvis.dev', NewRegistrar('none'), DnsProvider(NewDnsProvider('netlify')),
  IGNORE_NAME('*', 'NETLIFY'),
  IGNORE_NAME('*', 'NETLIFYv6'),
);

@abovedave
Copy link

abovedave commented Nov 23, 2022

Been thinking about this some more, as NETLIFY records are handled automatically when you create or delete sites, push branches etc, is there even as use case for modifying them through DNSControl?

I'm think the solution might be just transparently ignore as suggested.

@tlimoncelli
Copy link
Contributor

@abovedave Oh! That makes a lot of sense!

Copy link
Contributor

@tlimoncelli tlimoncelli left a comment

Choose a reason for hiding this comment

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

As far as the code is concerned, this all looks great! No suggestions.

I won't merge it until I hear from you about ignoring the NETLIFY records, etc.

pkg/js/helpers.js Outdated Show resolved Hide resolved
@SphericalKat
Copy link
Contributor Author

Hey, just got back to work on this. No, we don't need NETLIFY stuff in the helpers; I'll remove those and modify the provider to ignore NETLIFY records in a moment.

Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Co-authored-by: msfjarvis <me@msfjarvis.dev>

Signed-off-by: Amogh Lele <amolele@gmail.com>
…helpers

Signed-off-by: Amogh Lele <amolele@gmail.com>
also rename some functions to singular

Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Signed-off-by: Amogh Lele <amolele@gmail.com>
Copy link

@msfjarvis msfjarvis left a comment

Choose a reason for hiding this comment

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

Verified that the provider correctly skips the NETLIFY and NETLIFYv6 rtypes for my site

@tlimoncelli tlimoncelli merged commit 1618ace into StackExchange:master Nov 28, 2022
@tlimoncelli
Copy link
Contributor

Thank you for the contribution! A lot of people have asked for this!

@SphericalKat
Copy link
Contributor Author

Cheers!

@j-f1
Copy link
Contributor

j-f1 commented Nov 28, 2022

Thanks for adding this! Can you add a clarification to the docs about why someone would want to provide (or not provide) an account slug?

@j-f1
Copy link
Contributor

j-f1 commented Nov 30, 2022

@SphericalKat Not sure if you saw my comment above but it was a minor point of confusion as I was setting up my Netlify configuration ^

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.

Provider request: Netlify
5 participants