Skip to content

Add Docker credential token command - #6194

Open
yolocs wants to merge 1 commit into
databricks:mainfrom
yolocs:chen-shou_data/stack/dar-configure-docker
Open

yolocs wants to merge 1 commit into
databricks:mainfrom
yolocs:chen-shou_data/stack/dar-configure-docker

Conversation

@yolocs

@yolocs yolocs commented Aug 6, 2026

Copy link
Copy Markdown

🥞 Stacked PR (generated by git ns)

Use this link to review incremental changes.


Changes

Add the experimental databricks auth docker token command. It implements Docker credential-helper get: reads a registry address from stdin, resolves the matching workspace U2M profile, and returns Docker's credential JSON with a valid OAuth token.

Why

Docker supplies only the registry address to a credential helper. Mapping it to a workspace profile lets the CLI refresh short-lived OAuth tokens without storing registry credentials in Docker configuration.

Tests

  • ./task fmt RUFF=ruff, ./task checks, and ./task lint RUFF=ruff: pass
  • go test ./libs/dockercredentials ./cmd/auth ./cmd/root -count=1: pass
  • Docker auth acceptance cases passed in the full suite
  • Windows and macOS cross-compilation for affected test packages: pass
  • ./task test: 5,167 tests, 6 skipped, 43 unrelated bundle acceptance snapshot failures on the updated upstream base

This PR was written by Codex.

@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch 2 times, most recently from 1d40c84 to 8a31a21 Compare August 17, 2026 19:47
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread libs/dockercredentials/registry.go Outdated
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch 2 times, most recently from d8b031a to 3131910 Compare August 18, 2026 04:36

@renaudhartert-db renaudhartert-db 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.

Thanks @yolocs!

It is big PR with a lot of implicit decisions and behaviors. It would help if we could get more documentation about the intended behavior and usage. Could you maybe rewrite your PR description as if it were documentation intended for the user?

For example, the PR adds a new token format but this is documented nowhere currently. The only way to understand the intended usage is to reverse-guess it from the code.

Left a first round of quick feedback.

Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
Comment thread cmd/auth/configure_docker.go Outdated
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from 3d415da to 097fb03 Compare August 20, 2026 17:54
@yolocs yolocs changed the title Add Docker auth configuration for Artifact Registry Add Docker output format to auth token Aug 20, 2026
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch 2 times, most recently from cd0907f to 3ad7d11 Compare August 20, 2026 22:38
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from 3ad7d11 to f8d8ba8 Compare August 31, 2026 17:17
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from f8d8ba8 to 030d3d0 Compare September 8, 2026 01:13
@yolocs yolocs changed the title Add Docker output format to auth token Add Docker credential token command Sep 8, 2026
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch 4 times, most recently from 5c8926b to 2b5219d Compare September 9, 2026 01:20
@yolocs
yolocs marked this pull request as ready for review September 9, 2026 16:05
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/cmd/auth/ - needs approval

6 files changed
Suggested: @simonfaltum
Also eligible: @renaudhartert-db, @mihaimitrea-db, @Divyansh-db, @tanmay-db, @hectorcast-db, @parthban-db, @tejaskochar-db, @chrisst, @rauchy

General files (require maintainer)

12 files changed
Based on git history:

  • @simonfaltum -- recent work in cmd/auth/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.

@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from 2b5219d to 4fa2580 Compare September 11, 2026 16:46
Comment thread acceptance/cmd/auth/docker/script.prepare Outdated
setup_docker_auth

mkdir -p "$HOME/.databricks"
cp token-cache.json "$HOME/.databricks/token-cache.json"

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.

What's the purpose for keeping an existing token cache? What happens if there is no profile (yet)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The token cache represents an existing databricks auth login. A logged-in workspace profile is a prerequisite: the helper extracts the workspace ID from the registry hostname, finds the matching profile, and refreshes its cached OAuth token. Without a matching logged-in profile, it fails with guidance to run databricks auth login.

Comment thread cmd/auth/docker.go
return runDockerToken(ctx, cmd, loadTokenArgs{
authArguments: authArguments,
tokenTimeout: tokenTimeout,
// Docker may reuse one credential for a long upload, so maximize its lifetime by refreshing it by default.

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.

Is this right? If you do frequent push/pull this will over-refresh.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentional to work with large image pushes that could span a longer duration.

  • (Public) Pulls - Disallowed initially due to an infra restriction. So won't touch this part all.
  • Pushes - Much less frequent. And a single docker push command will only trigger this once and reuse the same credential for all the http requests in that push operation.

Comment thread cmd/auth/docker.go Outdated
Comment thread cmd/auth/docker_test.go Outdated
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from 4fa2580 to 2a708fb Compare September 14, 2026 20:56
@yolocs
yolocs force-pushed the chen-shou_data/stack/dar-configure-docker branch from 2a708fb to 7f52acb Compare September 14, 2026 21:29
@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: 6194
  • Commit SHA: 7f52acb7c77b38d1a66c427d7766e76cd45ae980

Checks will be approved automatically on success.

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.

3 participants