-
Notifications
You must be signed in to change notification settings - Fork 134
Move usage of config struct in auth login #4310
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
base: main
Are you sure you want to change the base?
Conversation
|
Commit: 9a12e75
26 interesting tests: 8 flaky, 7 KNOWN, 5 SKIP, 4 RECOVERED, 2 BUG
Top 50 slowest tests (at least 2 minutes):
|
10af05e to
76a6317
Compare
Improve comment Co-authored-by: Renaud Hartert <renaud.hartert@databricks.com>
…nly it works this time
cmd/auth/login.go
Outdated
| ConfigFile: cfg.ConfigFile, | ||
| ServerlessComputeID: cfg.ServerlessComputeID, | ||
| Host: authArguments.Host, | ||
| AuthType: "databricks-cli", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this refer to a constant?
renaudhartert-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo remaining comments.
| // 1. Configuring cluster and serverless; | ||
| // 2. Saving the profile. | ||
|
|
||
| var clusterID, serverlessComputeID string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need these variables compared to setting the value in cfg as it was done before? I'm not convinced have these here is a readability improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean moving cfg out of the switch block and accumulating values in it as before?
We have to either put them in cfg or in these variables. I wanted to move the cfg struct within the switch case to avoid others also getting confused about how the token command depends on the Go SDK, but I don't think thats a problem now since we've removed the databricks-cli auth type and added the comments you suggested. I don't have a strong opinion here but would lean towards keeping the config struct for configuring clusters separate from collecting fields to save to profile.
Changes
Refactors the
auth logincommand to make it clear that the config struct is only needed for making a request to configure clusters when a--configure-clustersflag is passed.The request itself is changed from using
databricks-cliauth type which creates a child CLI process to using the newly minted token directly in a custom auth type.Why
Reduce confusion about what part of the SDK is used by the CLI in the auth login command. This is being done as a part of an effort to make the
databricks-cliauth type consistent across the SDKs by having the Go SDK also rely on the CLI'sauth tokencommand like the Java and Python SDKs.Tests
--configure-clusterflag worksNO_CHANGELOG=true