Add support for default_profile in [__settings__] section#698
Open
simonfaltum wants to merge 5 commits intomainfrom
Open
Add support for default_profile in [__settings__] section#698simonfaltum wants to merge 5 commits intomainfrom
simonfaltum wants to merge 5 commits intomainfrom
Conversation
Adds support for the __settings__ section in .databrickscfg, enabling default_profile to specify which profile to use when none is explicitly set. The resolved profile is written back to DatabricksConfig so downstream consumers (e.g. DatabricksCliCredentialsProvider) see it. Rejects __settings__ as a profile target to prevent self-referencing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9dd595d to
39ecf38
Compare
Keep default_profile resolution aligned with the other SDKs by preserving the resolved profile name and surfacing bad settings targets instead of silently falling back.
Move all profile resolution logic (explicit, __settings__, DEFAULT fallback) into a single resolveProfile method that returns the profile name and whether it is a silent fallback. This replaces the two-boolean pattern (hasExplicitProfile, hasDefaultProfileSetting) with a clearer isFallback flag, and keeps __settings__ knowledge out of loadFromConfig entirely. Also improves error messages when __settings__ is used as a profile name: now says "reserved section name" instead of the generic "has no __settings__ profile configured". Co-authored-by: Isaac
Co-authored-by: Isaac
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[__settings__].default_profilein~/.databrickscfgbefore falling back to theDEFAULTsectionauth switchfeatureProfile resolution order:
--profileflag, env var, or programmatic config)[__settings__].default_profile(new)[DEFAULT]section (legacy fallback)Changes
ConfigLoader.java: Extracted aresolveProfilemethod that encapsulates all profile resolution logic (explicit,[__settings__].default_profile, DEFAULT fallback). Returns the resolved profile name and whether it is a silent fallback.loadFromConfigno longer needs to know about__settings__at all, replacing two booleans (hasExplicitProfile,hasDefaultProfileSetting) with a singleisFallbackflag.Using
__settings__as a profile name (either via--profileordefault_profile) now returns a specific error ("reserved section name") instead of the generic "has no profile configured".DefaultProfileTest.java: 8 test scenarios covering resolution, precedence, legacy fallback, empty settings, explicit override, settings-not-a-profile (both via default_profile and explicit --profile), and nonexistent profile error.Test plan
default_profileresolves correctlydefault_profiletakes precedence over[DEFAULT][__settings__]default_profileis empty[__settings__]is not treated as a profile (viadefault_profile)[__settings__]is not treated as a profile (via explicit--profile)--profileoverridesdefault_profiledefault_profilepointing to nonexistent section throws error