Skip to content

Allow account client auth with environment variables when no .databrickscfg file present - #1097

Merged
andrewnester merged 3 commits into
mainfrom
account-pauth-no-cfg
Jan 2, 2024
Merged

Allow account client auth with environment variables when no .databrickscfg file present#1097
andrewnester merged 3 commits into
mainfrom
account-pauth-no-cfg

Conversation

@andrewnester

@andrewnesterandrewnester commented Jan 2, 2024

Copy link
Copy Markdown
Contributor

Changes

Allow account client auth with environment variables when no .databrickscfg file present

Makes the behaviour to be in line with WorkspaceClient auth.

Tests

Added regression test

@codecov-commenter

codecov-commenter commented Jan 2, 2024

Copy link
Copy Markdown

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9cb0985) 48.18% compared to head (db91b88) 48.52%.

FilesPatch %Lines
cmd/root/auth.go50.00%1 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1097 +/- ##
==========================================
+ Coverage 48.18% 48.52% +0.33% 
==========================================
Files 268 268 Lines 10509 10510 +1 ==========================================
+ Hits 5064 5100 +36 + Misses 4894 4856 -38 - Partials 551 554 +3 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment threadcmd/root/auth_test.go Outdated
Comment threadcmd/root/auth_test.go Outdated
Comment threadcmd/root/auth.go
// 1. only admins will have account configured
// 2. 99% of admins will have access to just one account
// hence, we don't need to create a special "DEFAULT_ACCOUNT" profile yet
_, profiles, err := databrickscfg.LoadProfiles(cmd.Context(), databrickscfg.MatchAccountProfiles)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To retain behavior in the described case (many admins will have only a single account defined), we could check os.IsNotExist and fall through if that's the error. WDYT?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Agreed, added in a second revision

Comment threadcmd/root/auth.go Outdated
@andrewnester
andrewnester added this pull request to the merge queueJan 2, 2024
Merged via the queue into main with commit e80882bJan 2, 2024
@andrewnester
andrewnester deleted the account-pauth-no-cfg branch January 2, 2024 15:43
pietern added a commit that referenced this pull request Jan 11, 2024
CLI:
* Tweak command groups in CLI help ([#1092](#1092)).
* Fixed storage-credentials list command in text output ([#1094](#1094)).
* Allow account client auth with environment variables when no `.databrickscfg` file present ([#1097](#1097)).
* Always log with text format by default ([#1096](#1096)).
Bundles:
* Added exec.NewCommandExecutor to execute commands with correct interpreter ([#1075](#1075)).
* Use resource key as name in permissions code ([#1087](#1087)).
* Add support for reprompts if user input does not match template schema ([#946](#946)).
* Improve experience for multiple builtin templates ([#1052](#1052)).
* Improve error when bundle root is not writable ([#1093](#1093)).
* Change recommended production deployment path from `/Shared` to `/Users` ([#1091](#1091)).
* Allow referencing bundle resources by name ([#872](#872)).
* Make libs/exec fallback to `sh` if `bash` cannot be found ([#1114](#1114)).
Internal:
* Functionality to walk a `config.Value` tree ([#1081](#1081)).
* Rename libs/config -> libs/dyn ([#1086](#1086)).
* Added codecov integration on code push ([#1095](#1095)).
* Consolidate functions to convert `dyn.Value` to native types ([#1100](#1100)).
* Define constant for the invalid `dyn.Value` ([#1101](#1101)).
API Changes:
* Changed `databricks serving-endpoints update-config` command with new required argument order.
* Changed `databricks account ip-access-lists create` command with new required argument order.
* Changed `databricks account ip-access-lists replace` command with new required argument order.
* Changed `databricks account ip-access-lists update` command with new required argument order.
* Changed `databricks ip-access-lists create` command with new required argument order.
* Changed `databricks ip-access-lists replace` command with new required argument order.
* Changed `databricks ip-access-lists update` command with new required argument order.
OpenAPI commit a7a9dc025bb80303e676bf3708942c6aa06689f1 (2024-01-04)
Dependency updates:
* Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0 ([#1088](#1088)).
* Bump go.uber.org/mock from 0.3.0 to 0.4.0 ([#1089](#1089)).
* Bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0 ([#1090](#1090)).
* Bump golang.org/x/term from 0.15.0 to 0.16.0 ([#1103](#1103)).
* Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 ([#1105](#1105)).
* Bump golang.org/x/sync from 0.5.0 to 0.6.0 ([#1104](#1104)).
* Upgrade golang.org/x/crypto to v0.17.0 in internal module ([#1110](#1110)).
* Upgrade Go SDK to v0.29.0 ([#1111](#1111)).
@pieternpietern mentioned this pull request Jan 11, 2024
github-merge-queueBot pushed a commit that referenced this pull request Jan 11, 2024
CLI:
* Tweak command groups in CLI help
([#1092](#1092)).
* Fixed storage-credentials list command in text output
([#1094](#1094)).
* Allow account client auth with environment variables when no
`.databrickscfg` file present
([#1097](#1097)).
* Always log with text format by default
([#1096](#1096)).
Bundles:
* Added exec.NewCommandExecutor to execute commands with correct
interpreter ([#1075](#1075)).
* Use resource key as name in permissions code
([#1087](#1087)).
* Add support for reprompts if user input does not match template schema
([#946](#946)).
* Improve experience for multiple builtin templates
([#1052](#1052)).
* Improve error when bundle root is not writable
([#1093](#1093)).
* Change recommended production deployment path from `/Shared` to
`/Users` ([#1091](#1091)).
* Allow referencing bundle resources by name
([#872](#872)).
* Make libs/exec fallback to `sh` if `bash` cannot be found
([#1114](#1114)).
Internal:
* Functionality to walk a `config.Value` tree
([#1081](#1081)).
* Rename libs/config -> libs/dyn
([#1086](#1086)).
* Added codecov integration on code push
([#1095](#1095)).
* Consolidate functions to convert `dyn.Value` to native types
([#1100](#1100)).
* Define constant for the invalid `dyn.Value`
([#1101](#1101)).
API Changes:
* Changed `databricks serving-endpoints update-config` command with new
required argument order.
* Changed `databricks account ip-access-lists create` command with new
required argument order.
* Changed `databricks account ip-access-lists replace` command with new
required argument order.
* Changed `databricks account ip-access-lists update` command with new
required argument order.
* Changed `databricks ip-access-lists create` command with new required
argument order.
* Changed `databricks ip-access-lists replace` command with new required
argument order.
* Changed `databricks ip-access-lists update` command with new required
argument order.
OpenAPI commit a7a9dc025bb80303e676bf3708942c6aa06689f1 (2024-01-04)
Dependency updates:
* Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0
([#1088](#1088)).
* Bump go.uber.org/mock from 0.3.0 to 0.4.0
([#1089](#1089)).
* Bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0
([#1090](#1090)).
* Bump golang.org/x/term from 0.15.0 to 0.16.0
([#1103](#1103)).
* Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7
([#1105](#1105)).
* Bump golang.org/x/sync from 0.5.0 to 0.6.0
([#1104](#1104)).
* Upgrade golang.org/x/crypto to v0.17.0 in internal module
([#1110](#1110)).
* Upgrade Go SDK to v0.29.0
([#1111](#1111)).
denik pushed a commit that referenced this pull request May 20, 2026
…ckscfg file present (#1097)
## Changes
Allow account client auth with environment variables when no
.databrickscfg file present
Makes the behaviour to be in line with WorkspaceClient auth.
## Tests
Added regression test
denik pushed a commit that referenced this pull request May 20, 2026
CLI:
* Tweak command groups in CLI help
([#1092](#1092)).
* Fixed storage-credentials list command in text output
([#1094](#1094)).
* Allow account client auth with environment variables when no
`.databrickscfg` file present
([#1097](#1097)).
* Always log with text format by default
([#1096](#1096)).
Bundles:
* Added exec.NewCommandExecutor to execute commands with correct
interpreter ([#1075](#1075)).
* Use resource key as name in permissions code
([#1087](#1087)).
* Add support for reprompts if user input does not match template schema
([#946](#946)).
* Improve experience for multiple builtin templates
([#1052](#1052)).
* Improve error when bundle root is not writable
([#1093](#1093)).
* Change recommended production deployment path from `/Shared` to
`/Users` ([#1091](#1091)).
* Allow referencing bundle resources by name
([#872](#872)).
* Make libs/exec fallback to `sh` if `bash` cannot be found
([#1114](#1114)).
Internal:
* Functionality to walk a `config.Value` tree
([#1081](#1081)).
* Rename libs/config -> libs/dyn
([#1086](#1086)).
* Added codecov integration on code push
([#1095](#1095)).
* Consolidate functions to convert `dyn.Value` to native types
([#1100](#1100)).
* Define constant for the invalid `dyn.Value`
([#1101](#1101)).
API Changes:
* Changed `databricks serving-endpoints update-config` command with new
required argument order.
* Changed `databricks account ip-access-lists create` command with new
required argument order.
* Changed `databricks account ip-access-lists replace` command with new
required argument order.
* Changed `databricks account ip-access-lists update` command with new
required argument order.
* Changed `databricks ip-access-lists create` command with new required
argument order.
* Changed `databricks ip-access-lists replace` command with new required
argument order.
* Changed `databricks ip-access-lists update` command with new required
argument order.
OpenAPI commit a7a9dc025bb80303e676bf3708942c6aa06689f1 (2024-01-04)
Dependency updates:
* Bump github.com/hashicorp/terraform-exec from 0.19.0 to 0.20.0
([#1088](#1088)).
* Bump go.uber.org/mock from 0.3.0 to 0.4.0
([#1089](#1089)).
* Bump github.com/hashicorp/terraform-json from 0.18.0 to 0.20.0
([#1090](#1090)).
* Bump golang.org/x/term from 0.15.0 to 0.16.0
([#1103](#1103)).
* Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7
([#1105](#1105)).
* Bump golang.org/x/sync from 0.5.0 to 0.6.0
([#1104](#1104)).
* Upgrade golang.org/x/crypto to v0.17.0 in internal module
([#1110](#1110)).
* Upgrade Go SDK to v0.29.0
([#1111](#1111)).
Sign up for freeto 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

@andrewnester@codecov-commenter@pietern