-
Notifications
You must be signed in to change notification settings - Fork 73
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
Try to resolve a profile if only the host is specified #287
Conversation
This improves out of the box usability where a user who already configured a `.databrickscfg` file will be able to reference the workspace host in their `bundle.yml` and it will automatically pick up the right profile.
Note: the file |
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.
Looks good! just some minor comments
// The function expands ~ to the user's home directory. | ||
func LoadFile(path string) (*File, error) { | ||
if path == "" { | ||
path = "~/.databrickscfg" |
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.
This not work for windows, can be added as a followup though
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.
I copied this functionality from the SDK where it does work on Windows (tests pass and this is covered).
I added your comment to the PR that changes it though, so it can be explored there (link)
Once the File
type is merged in the SDK it can be removed here and depended on directly.
} | ||
|
||
// Expand ~ to home directory. | ||
if strings.HasPrefix(path, "~") { |
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.
nit: It's possible to create a dir named ~foo
. Maybe you would like to use filepath.SplitList
?
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.
Added this to the same comment in the SDK. It could use os.PathSeparator
.
Co-authored-by: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com>
Co-authored-by: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com>
@shreyas-goenka Thanks for the review. Punting the Windows comments to the SDK (see databricks/databricks-sdk-go#349). |
## Changes Auth relied on setting a profile. In this change we enumerate all configuration properties and export all non-empty ones as a map with environment variables. We then pass this map to the Terraform execution wrapper. This results in Terraform using the bundle's authentication configuration. This change is needed to make #287 work. ## Tests Manually.
Changes
This improves out of the box usability where a user who already configured a
.databrickscfg
file will be able to reference the workspace host in theirbundle.yml
and it will automatically pick up the right profile.Tests