Add default GitHub API URLs to SSO connector#31397
Conversation
`tctl sso configure github` was producing an untestable connector
spec, or at least a spec that would _always fail_ when tested with
`tctl ssl test`, due to missing GitHub endpoints in the generated
spec.
This change adds the default GitHub endpoint URLs as default values
for the endpoint flags in `tctl sso configure github` so that the
produces spec is valis and testable.
Note: Our WebUI appears to magically add these values when saving
a connector, so this issue only really effects `tctl sso test`
Includes doc update to match new output.
Fixes: #31396
Changelog: `tctl sso configure github` now includes default Github endpoints
| // GetEndpointURL returns the endpoint URL | ||
| func (c *GithubConnectorV3) GetEndpointURL() string { | ||
| return githubURL | ||
| return GithubURL |
There was a problem hiding this comment.
Is anyone else curious why this always returns a constant? Is this because SSO for self-hosted github is an enterprise-only feature?
|
I've given the old code a cursory look before and from my understanding the validation is being too strict here; in particular, you can expect there to be some existing configs that are correct (using public GitHub, so these fields can be empty) but will now be rejected. Sounds wrong, and I'd be curious to see where exactly the error is being thrown: |
I don't think this is necessarily a validation problem, and I certainly didn't add any - I just changed the generated connector so that it works in the test.
Given your comments that it sounded wrong, I dug a bit deeper. Turns out this is what happens when you use an Enterprise The error was coming from deep inside the All in all it's a bit confusing confusing as a user, as both flavours of |
Agreed. I think @capnspacehook may have the best idea of what needs fixing in this context. |
| sub.Flag("endpoint-url", "Endpoint URL for GitHub instance."). | ||
| PlaceHolder("URL"). | ||
| Default(types.GithubURL). | ||
| StringVar(&spec.EndpointURL) |
There was a problem hiding this comment.
If it's a URL, should we use URLVar instead of StringVar?
tctl sso configure githubwas producing an untestable connector spec, or at least a spec that would always fail when tested withtctl sso test, due to missing GitHub endpoints in the generated spec.This change adds the default GitHub endpoint URLs as default values for the endpoint flags in
tctl sso configure githubso that the produces spec is valis and testable.Note: Our WebUI appears to magically add these values when saving
a connector, so this issue only really effects
tctl sso testIncludes doc update to match new output.
Fixes: #31396
Changelog:
tctl sso configure githubnow includes default Github endpoints