Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 213
Make an explicitly selected profile take precedence over auth environment variables#5702
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
403af4cb24452268a07f772e217e95aacc0a8e961c8ef7b6a29d2b24File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| === api without --profile uses env auth, ignoring default_profile (#5616) | ||
| >>> [CLI] api get /api/2.0/clusters/list | ||
| {} | ||
| >>> print_requests.py --get //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Workspace-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| sethome "./home" | ||
| # A default profile with conflicting (basic) auth on a different host. The env | ||
| # below still points a PAT at the test server. Without the #5616 guard, the | ||
| # default profile would be pinned and merged with the env PAT, failing with | ||
| # "more than one authorization method configured". | ||
| cat > "./home/.databrickscfg" <<EOF | ||
| [__settings__] | ||
| default_profile = other | ||
| [other] | ||
| host = https://other.cloud.databricks.test | ||
| username = user | ||
| password = pass | ||
| EOF | ||
| title "api without --profile uses env auth, ignoring default_profile (#5616)\n" | ||
| MSYS_NO_PATHCONV=1 trace $CLI api get /api/2.0/clusters/list | ||
| trace print_requests.py --get //api/2.0/clusters/list |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home", | ||
| ] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| === api --profile overrides auth env vars (#5096) | ||
| >>> [CLI] api get /api/2.0/clusters/list --profile my-workspace | ||
| {} | ||
| >>> print_requests.py --get //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Workspace-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } | ||
| === api host-only --profile fills the token from the environment (#5096) | ||
| >>> [CLI] api get /api/2.0/clusters/list --profile host-only | ||
| {} | ||
| >>> print_requests.py --get //api/2.0/clusters/list | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ], | ||
| "User-Agent": [ | ||
| "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/api_get cmd-exec-id/[UUID] interactive/none auth/pat" | ||
| ], | ||
| "X-Databricks-Workspace-Id": [ | ||
| "[NUMID]" | ||
| ] | ||
| }, | ||
| "method": "GET", | ||
| "path": "/api/2.0/clusters/list" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| sethome "./home" | ||
| # One profile with full credentials, one host-only; both point at the test | ||
| # server while the auth env vars below point elsewhere. | ||
| cat > "./home/.databrickscfg" <<EOF | ||
| [my-workspace] | ||
| host = $DATABRICKS_HOST | ||
| token = $DATABRICKS_TOKEN | ||
| [host-only] | ||
| host = $DATABRICKS_HOST | ||
| EOF | ||
| # direnv-style auth env vars for a different workspace; before #5096 these | ||
| # shadowed the profile selected with --profile. | ||
| real_token=$DATABRICKS_TOKEN | ||
| export DATABRICKS_HOST=https://dev.cloud.databricks.test | ||
| export DATABRICKS_TOKEN=dev-token | ||
| title "api --profile overrides auth env vars (#5096)\n" | ||
| MSYS_NO_PATHCONV=1 trace $CLI api get /api/2.0/clusters/list --profile my-workspace | ||
| trace print_requests.py --get //api/2.0/clusters/list | ||
| # Host-only profile: the profile wins for the host, but env fills the token it | ||
| # omits (#5096). | ||
| export DATABRICKS_TOKEN=$real_token | ||
| title "api host-only --profile fills the token from the environment (#5096)\n" | ||
| MSYS_NO_PATHCONV=1 trace $CLI api get /api/2.0/clusters/list --profile host-only | ||
| trace print_requests.py --get //api/2.0/clusters/list |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home", | ||
| ] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| === Describe with --profile overrides auth env vars (#5096) | ||
| >>> [CLI] auth describe --profile my-workspace | ||
| Host: [DATABRICKS_URL] | ||
| User: [USERNAME] | ||
| Authenticated with: pat | ||
| ----- | ||
| Current configuration: | ||
| ✓ host: [DATABRICKS_URL] (from [TEST_TMP_DIR]/home/.databrickscfg config file) | ||
| ✓ workspace_id: [NUMID] | ||
| ✓ token: ******** (from [TEST_TMP_DIR]/home/.databrickscfg config file) | ||
| ✓ profile: my-workspace (from --profile flag) | ||
| ✓ databricks_cli_path: [CLI] | ||
| ✓ auth_type: pat | ||
| ✓ rate_limit: [NUMID] (from DATABRICKS_RATE_LIMIT environment variable) | ||
| ✓ cloud: AWS | ||
| ✓ discovery_url: [DATABRICKS_URL]/oidc/.well-known/oauth-authorization-server | ||
| === Describe with a host-only --profile fills the token from the environment (#5096) | ||
| >>> [CLI] auth describe --profile host-only | ||
| Host: [DATABRICKS_URL] | ||
| User: [USERNAME] | ||
| Authenticated with: pat | ||
| ----- | ||
| Current configuration: | ||
| ✓ host: [DATABRICKS_URL] (from [TEST_TMP_DIR]/home/.databrickscfg config file) | ||
| ✓ workspace_id: [NUMID] | ||
| ✓ token: ******** (from DATABRICKS_TOKEN environment variable) | ||
| ✓ profile: host-only (from --profile flag) | ||
| ✓ databricks_cli_path: [CLI] | ||
| ✓ auth_type: pat | ||
| ✓ rate_limit: [NUMID] (from DATABRICKS_RATE_LIMIT environment variable) | ||
| ✓ cloud: AWS | ||
| ✓ discovery_url: [DATABRICKS_URL]/oidc/.well-known/oauth-authorization-server |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| sethome "./home" | ||
| # A profile carries full credentials; a second profile carries only a host. | ||
| cat > "./home/.databrickscfg" <<EOF | ||
| [my-workspace] | ||
| host = $DATABRICKS_HOST | ||
| token = $DATABRICKS_TOKEN | ||
| [host-only] | ||
| host = $DATABRICKS_HOST | ||
| EOF | ||
| # direnv-style auth env vars for a different workspace; before #5096 these | ||
| # shadowed the profile selected with --profile. | ||
| real_token=$DATABRICKS_TOKEN | ||
| export DATABRICKS_HOST=https://dev.cloud.databricks.test | ||
| export DATABRICKS_TOKEN=dev-token | ||
| title "Describe with --profile overrides auth env vars (#5096)\n" | ||
| trace $CLI auth describe --profile my-workspace | ||
| # Host-only profile: the profile wins for the host, but env fills the token it | ||
| # omits (#5096). | ||
| export DATABRICKS_TOKEN=$real_token | ||
| title "Describe with a host-only --profile fills the token from the environment (#5096)\n" | ||
| trace $CLI auth describe --profile host-only |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Ignore = [ | ||
| "home" | ||
| ] |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.