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 (db52460) ❌ | latest (v1.26.0) ❌main (db52460): latest (v1.26.0): TestAccept/cmd/auth/docker/help: branch ✅ | main (db52460) ❌ | latest (v1.26.0) ❌main (db52460): latest (v1.26.0): same output as main (db52460) TestAccept/cmd/auth/docker/token: branch ✅ | main (db52460) ❌ | latest (v1.26.0) ❌main (db52460): latest (v1.26.0): |
✅ Integration test reportCommit: 68233ed
Top 34 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? |
49a2dc9 to
4b40835
Compare
auth docker configure no longer fails when several profiles match the workspace. It marks the selected profile with docker_credential_helper = true in .databrickscfg, clears the mark from the workspace's other profiles, and warns when the selection switches. auth docker token uses the recorded profile when several match, and auth docker host reports the helper as configured only if Docker's config selects it and it uses that profile. Saving a profile with a different host or workspace ID drops its mark, so it cannot follow the profile to another workspace. Co-authored-by: Isaac <no-reply@databricks.com>
4b40835 to
68233ed
Compare
|
@pietern I'm now trying a better way to disambiguate the profile. It saves a new value in |
Changes
databricks auth docker configure <profile>no longer fails when several profiles match the selected workspace. It records the chosen profile in its.databrickscfgsection withdocker_credential_helper = trueand removes the mark from the workspace's other profiles. Running it with another profile switches the selection:databricks auth docker token(the Docker credential helper) picks the profile for a registry like this:... Select the profile for Docker with: databricks auth docker configure <profile-name>.Saving a profile with a different host or workspace ID, for example
auth login --profile prod --host <other-workspace>ordatabricks configure --host, drops its mark, so the mark cannot follow the profile to another workspace.databricks auth docker host --profile Preports the helper as configured only if Docker'sconfig.jsonselects it for the registry, it is onPATH, and it would useP.Why
Docker gives the credential helper only the registry host, which encodes the workspace ID, so the helper cannot tell which of several matching profiles was meant.
auth loginnow savesworkspace_idon every profile, so two logins to one workspace were enough to blockauth docker configure. Recording the choice at configure time meansdocker pushuses the profile that was configured, whatever the order in.databrickscfg, and the helper never switches identity on its own.The mark lives on the profile section, so it follows
DATABRICKS_CONFIG_FILE, is removed byauth logout --delete, and survives re-logging in to the same workspace. The Go SDK ignores it because it reads only known attributes. Docker'sconfig.jsoncannot hold it, becausedocker loginrewrites that file and drops unknown keys.This replaces the "remove the duplicate profile" hint that #7363 added in v1.25.0.
Follow-up: matching still compares only the workspace ID and loopback vs remote host, so a profile on another Databricks deployment with the same workspace ID also matches.
Tests
ProfileForRegistry(recorded profile wins, unsupported recorded profile fails, several recorded, none recorded),RecordProfile(first record, switch, already recorded, stale marks on unsupported profiles cleared, other workspaces untouched, round trip withProfileForRegistry),SetDockerCredentialHelperProfile(including dotted section names),SaveToProfiledropping the mark when the host or workspace ID changes, the profile loader, andInspect(Docker config,PATHand profile selection are all required).cmd/auth/docker/{configure,configure-errors,token,help}. Configure switches to another profile and back, withhostreporting which profile Docker uses, and prints the resulting.databrickscfg. Token errors when several profiles match and none is recorded, uses the recorded profile over an earlier logged-in one, and errors when several are recorded.go test ./cmd/... ./libs/dockercredentials/... ./libs/auth/... ./libs/databrickscfg/...andgo test ./acceptance -run 'TestAccept/(cmd|air|auth)/'pass, includingair/image-push, which parses theauth docker configureoutput. Lint, deadcode, whitespace and changelog checks pass.This pull request and its description were written by Isaac.