Skip to content

Add Lakebox CLI for managing Databricks sandbox environments#4930

Draft
shuochen0311 wants to merge 8 commits intodatabricks:mainfrom
shuochen0311:lakebox-cli
Draft

Add Lakebox CLI for managing Databricks sandbox environments#4930
shuochen0311 wants to merge 8 commits intodatabricks:mainfrom
shuochen0311:lakebox-cli

Conversation

@shuochen0311
Copy link
Copy Markdown

Summary

Lakebox provides SSH-accessible development environments backed by microVM isolation. This adds CLI commands for lifecycle management.

Commands

  • lakebox auth login — authenticate to a Databricks workspace
  • lakebox create — create a new lakebox (with optional SSH public key)
  • lakebox list — list your lakeboxes (shows status, key hash, default)
  • lakebox ssh — SSH to your default lakebox (or create one on first use)
  • lakebox status <id> — show lakebox details
  • lakebox delete <id> — delete a lakebox
  • lakebox set-default <id> — change the default lakebox

Features

  • Default lakebox management stored at ~/.databricks/lakebox.json per profile
  • Automatic ~/.ssh/config management (single block, in-place update)
  • Public key auth only (password/keyboard-interactive disabled in SSH config)
  • Creates and sets default on first lakebox ssh if none exists
  • Talks to the lakebox REST API at /api/2.0/lakebox on the workspace host

Test plan

  • Tested e2e against dbsql-dev-testing-default.dev.databricks.com
  • Create, list, status, delete, ssh all working
  • Default management (set on create, clear on delete, reuse on ssh)

This PR was created by the Lakebox team (Infra2.0/Brickvisor).

Lakebox provides SSH-accessible development environments backed by
microVM isolation. This adds CLI commands for lifecycle management:

- `lakebox auth login` — authenticate to a Databricks workspace
- `lakebox create` — create a new lakebox (with optional SSH public key)
- `lakebox list` — list your lakeboxes (shows status, key hash, default)
- `lakebox ssh` — SSH to your default lakebox (or create one on first use)
- `lakebox status <id>` — show lakebox details
- `lakebox delete <id>` — delete a lakebox
- `lakebox set-default <id>` — change the default lakebox

Features:
- Default lakebox management stored at ~/.databricks/lakebox.json per profile
- Automatic SSH config management (~/.ssh/config)
- Public key auth only (password/keyboard-interactive disabled in SSH config)
- Creates and sets default on first `lakebox ssh` if none exists
@github-actions
Copy link
Copy Markdown

Waiting for approval

Based on git history, these people are best suited to review:

Eligible reviewers: @andrewnester, @denik, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@pietern pietern marked this pull request as draft April 13, 2026 09:38
shuochen0311 and others added 7 commits April 13, 2026 20:29
- Remove PubkeyHashPrefix field from lakeboxEntry (no longer returned by API)
- Remove KEY column from list output
- Remove Key line from status output
- Add register-key subcommand for SSH public key registration

Co-authored-by: Isaac
…rites

- Add 'register' command: generates ~/.ssh/lakebox_rsa and registers with API
- Remove 'register-key' command (replaced by 'register')
- Remove 'login' command (use 'auth login' + 'register' separately)
- SSH command passes options directly as args instead of writing ~/.ssh/config
- Check for ssh-keygen availability with helpful install instructions

Co-authored-by: Isaac
- Hook into auth login PostRun to auto-generate ~/.ssh/lakebox_rsa and
  register it after OAuth completes
- Fix hook: match on sub.Name() not sub.Use (Use includes args)
- Export EnsureAndReadKey and RegisterKey for use by auth hook
- Update help text

Co-authored-by: Isaac
Everything after -- is passed directly to the ssh process, enabling:
  lakebox ssh -- echo hello          # run command and return
  lakebox ssh <id> -- cat /etc/os-release
  lakebox ssh -- -L 8080:localhost:8080  # port forwarding

Co-authored-by: Isaac
After 'lakebox auth login --host <url>', the post-login hook now
constructs the workspace client directly from the --host/--profile
flags instead of using MustWorkspaceClient (which started with an
empty config and fell back to the DEFAULT profile).

All lakebox commands now use a mustWorkspaceClient wrapper that reads
the last-login profile from ~/.databricks/lakebox.json, so 'lakebox ssh'
uses the correct profile without requiring --profile on every invocation.

Also adds install.sh and upload.sh scripts.
Fix workspace client init after login, persist last profile
Merge kelvich's workspace client fix. Add -- passthrough support so
extra args (remote commands, port forwarding, ssh flags) are passed
directly to the ssh process.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

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

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4930
  • Commit SHA: ebda5a0bc86304d74678917ad2fbfab26fe086d7

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.

2 participants