Skip to content

fix: auth describe should not label DATABRICKS_CONFIG_PROFILE as from bundle#5904

Merged
janniklasrose merged 3 commits into
databricks:mainfrom
mvanhorn:fix/auth-describe-config-profile-env
Jul 15, 2026
Merged

fix: auth describe should not label DATABRICKS_CONFIG_PROFILE as from bundle#5904
janniklasrose merged 3 commits into
databricks:mainfrom
mvanhorn:fix/auth-describe-config-profile-env

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Changes

databricks auth describe reports the wrong source for the profile
configuration attribute when run inside a bundle root while the profile was
selected via the DATABRICKS_CONFIG_PROFILE environment variable. It renders
(from bundle) instead of (from DATABRICKS_CONFIG_PROFILE environment variable).

Fixes #2303.

Inside a bundle root, Workspace.Config() (bundle/config/workspace.go) labels
every resolved attribute with the bundle source, so a profile that actually
came from the environment is misattributed. getAuthDetails already
post-processes attribute sources to correct the --profile and --host flag
cases; this extends the profile branch to also detect
DATABRICKS_CONFIG_PROFILE, following the same precedence as
cmd/root/bundle.go's getProfile (an explicit --profile flag wins, then the
environment variable). The env branch relabels only when the environment
variable equals the resolved profile value, so a profile set in databricks.yml
still reads (from bundle) and flag precedence is preserved.

Why

When debugging auth inside a bundle, the source label is the whole point of
auth describe: it tells you where a value came from. Attributing an
environment-selected profile to the bundle is misleading and sends users
looking in the wrong place (databricks.yml) for a value that came from their
shell.

Tests

Added an acceptance test under
acceptance/cmd/auth/describe/bundle-profile-env/ that runs auth describe
inside a bundle root with DATABRICKS_CONFIG_PROFILE set and asserts the
profile renders (from DATABRICKS_CONFIG_PROFILE environment variable) while
genuine bundle attributes (host, timeouts) still render (from bundle).
go build ./..., go test ./cmd/auth/..., and the new acceptance test pass.

Closes #2303

…source

Inside a bundle root the resolved config labels every attribute with the
"bundle" source, so a profile selected via DATABRICKS_CONFIG_PROFILE was
rendered as "(from bundle)" instead of "(from DATABRICKS_CONFIG_PROFILE
environment variable)". Extend getAuthDetails to detect the env var, mirroring
the flag > env precedence in cmd/root/bundle.go:getProfile. The value guard
keeps genuine bundle-file profiles reading "(from bundle)".

Closes databricks#2303

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M1ZTEJFKv3BAW36VmBwe2v

@janniklasrose janniklasrose left a comment

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.

Thank you for the contribution 🚀

Comment thread .nextchanges/cli/auth-describe-config-profile-env.md Outdated
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 5904
  • Commit SHA: bd5e7f364a05b80b291b7c6fef6eb80df31953a8

Checks will be approved automatically on success.

@janniklasrose

Copy link
Copy Markdown
Contributor

All status checks passed in #5930

@janniklasrose janniklasrose merged commit a2e9017 into databricks:main Jul 15, 2026
15 of 23 checks passed
deco-sdk-tagging Bot added a commit that referenced this pull request Jul 15, 2026
## Release v1.8.0

### Notable Changes

 * Auto-migrate a bundle from terraform to the direct engine when `bundle.engine` is `"direct"` (or `DATABRICKS_BUNDLE_ENGINE=direct`) and the post-deploy dry-run migration is clean; a warning is emitted if the dry-run surfaces errors or warnings so the automatic migration is skipped.

### CLI

 * experimental `ssh connect`: bare `python`/`pip` in an interactive session now resolve to the environment interpreter (`$DATABRICKS_VIRTUAL_ENV`) instead of the system or cluster-libraries interpreter, so packages installed in the environment are importable without extra setup. The interactive shell is now non-login (`bash -i`) and the server seeds a `~/.bashrc` snippet that re-prepends the environment's bin directory to `PATH` ([#5888](#5888)).
 * When Claude Code runs the CLI without the Databricks AI tooling installed, the CLI now prints a one-line recommendation on stderr to run `databricks aitools install`. The recommendation is shown at most once per hour per Claude session, and never for human callers or `aitools` commands.
 * Fixed `databricks auth describe` misattributing a profile selected via `DATABRICKS_CONFIG_PROFILE` as `(from bundle)` when run inside a bundle root ([#5904](#5904)).

### Bundles

 * `bundle generate` now warns when the generated configuration file is not matched by any pattern in the `include` section of `databricks.yml` ([#5868](#5868)).
 * direct: Match UC Auto Upgrade managed property defaults with a wildcard pattern instead of enumerating each key ([#5877](#5877)).
 * Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](#5891)).
 * `databricks bundle init` now reports an actionable error when given a template URL with an unsupported protocol (`http://`, `git://`, `ftp://`, `ftps://`) instead of failing with a confusing "not a bundle template" message ([#5902](#5902)).
 * Added an `env:` section to `scripts.<name>` for declaring environment variables that may reference `${bundle.*}`, `${workspace.*}`, and `${var.*}` ([#4179](#4179), [#5299](#5299)).
Sign up for free to 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.

databricks auth describe misattributes auth credentials source inside a bundle

2 participants