Repository navigation
Conversation
849da49 to
71222b5
Compare
|
Commit: Regression test reportSelected 4 changed tests (limit=20, 0 not selected) 4 tests: regression=3 unreleased=0 coverage=1 failing=0
TestAccept/cmd/auth/docker/configure: branch ✅ | main (a572447) ❌ | latest (v1.26.0) ❌main (a572447): latest (v1.26.0): same output as main (a572447) TestAccept/cmd/auth/docker/help: branch ✅ | main (a572447) ❌ | latest (v1.26.0) ❌main (a572447): latest (v1.26.0): same output as main (a572447) TestAccept/cmd/auth/docker/token: branch ✅ | main (a572447) ❌ | latest (v1.26.0) ❌main (a572447): latest (v1.26.0): same output as main (a572447) |
✅ Integration test reportCommit: 49a2dc9
Top 13 slowest tests (at least 2 minutes):
|
71222b5 to
79702a7
Compare
pietern
left a comment
There was a problem hiding this comment.
This can have unintended side effects. Let's say you configure Docker assuming profile B, but profile A is earlier in the .databrickscfg for the same workspace host. What happens? Does a docker push use profile A?
I recommend using the "default profile" switcher (run databricks auth switch to see what happens) to be the tie-breaker, if it exists, and keep the error otherwise.
@pietern Yes, it will indeed have potential unintended effects. The problem originates from the credential helper protocol which can only use hostname (not profile) to pick the profile to get the auth token. And our user feedback suggested they'd prefer allowing profiles linking to the same workspace. Your suggest would only work if one of such profiles is the default profile, right? |
auth docker configure now prints a warning instead of failing when several databricks-cli profiles match the workspace. auth docker token uses the first logged-in matching profile, skipping only profiles with no cached login or a rejected refresh token; any other error is returned so the helper never switches identity on a transient failure. Co-authored-by: Isaac <no-reply@databricks.com>
79702a7 to
49a2dc9
Compare
Changes
databricks auth docker configureno longer fails when several databricks-cli profiles match the selected workspace. It configures Docker and prints a warning:databricks auth docker token(the Docker credential helper) tries the matching profiles in profile order ([DEFAULT]first, then file order) and uses the first one that is logged in. It skips a profile only when it has no cached login, no refresh token, or a rejected refresh token. Any other error (network, server, timeout, cancellation) is returned, so the helper never switches identity because of a transient failure. A single matching profile behaves as before, including its error text.To tell a cache miss apart from other errors,
loadTokennow keepsstorage.ErrNotFoundin its error chain viastorage.NewNotFoundHint.databricks auth tokenmessages are unchanged.Why
Docker gives the credential helper only the registry host, which encodes the workspace ID, so the helper maps it back to a profile by
workspace_id.auth loginnow savesworkspace_idon every profile, so two logins to the same workspace were enough to blockauth docker configure.This replaces the "remove the duplicate profile" hint that #7363 added in v1.25.0.
Tests
TestProfilesForRegistryandTestTokenForRegistrycover first-wins, skipping each logged-out case, stopping on other errors and on cancellation, and the unchanged single-profile path.TestToken_loadTokennow asserts thatErrNotFoundandErrMissingRefreshTokenstay in the error chain.cmd/auth/docker/{configure,configure-errors,token,help}. Configure warns and succeeds when profiles share a workspace. Token picks the first logged-in profile (the two profiles have different cached tokens), skips a logged-out profile on the default force-refresh path, and lists every profile when none is logged in.go test ./cmd/auth/... ./libs/dockercredentials/... ./libs/auth/... ./libs/databrickscfg/...andgo test ./acceptance -run TestAccept/cmd/authpass. Lint, deadcode, and whitespace checks pass.This pull request and its description were written by Isaac.