Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nextchanges/cli/aitools-hint-respects-opt-out.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* When the automatic installation of Databricks AI tools is turned off (for example by `databricks aitools auto-install disable` or `DATABRICKS_AITOOLS_AUTO_INSTALL=false`), the CLI no longer prints its install hint for coding agents or Claude Code's plugin install line. ([#8211](https://github.com/databricks/cli/pull/8211))
* When the automatic installation of Databricks AI tools is turned off (for example by `databricks aitools auto-install disable` or `DATABRICKS_AITOOLS_AUTO_INSTALL=false`), the CLI no longer prints its install hint for coding agents or Claude Code's plugin install line. ([#8194](https://github.com/databricks/cli/pull/8194), [#8211](https://github.com/databricks/cli/pull/8211))
1 change: 1 addition & 0 deletions .nextchanges/cli/sandbox-public-lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Use the public Sandbox SDK for `databricks sandbox` lifecycle commands, including native SDK JSON output that requires scripts using the previous field names to migrate; preserve short IDs, readiness and terminal text, with SSH through port forwarding. ([#8040](https://github.com/databricks/cli/pull/8040))
8 changes: 8 additions & 0 deletions acceptance/cmd/sandbox/config/update-name/sandbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"display_name": "renamed-project",
"spec": {
"compute": {
"inactivity_timeout": "900s"
}
}
}
3 changes: 3 additions & 0 deletions acceptance/cmd/sandbox/config/update-name/script
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes?sandbox_id=happy-panda-1234 --json @sandbox.json > LOG.seed-0
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/sandboxes/happy-panda-1234 > LOG.ready-happy-panda-1234

$CLI sandbox config happy-panda-1234 --name renamed-project
10 changes: 0 additions & 10 deletions acceptance/cmd/sandbox/config/update-name/test.toml

This file was deleted.

2 changes: 2 additions & 0 deletions acceptance/cmd/sandbox/create/json/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.JSON_FLAGS = ["--json", "-o json"]
24 changes: 24 additions & 0 deletions acceptance/cmd/sandbox/create/json/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"display_name": "my-project",
"name": "sandboxes/[SANDBOX_ID]",
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
},
"status": {
"state": "SANDBOX_STATE_RUNNING"
}
}

=== JSON creation retains text output, short default IDs and cached labels

>>> [CLI] sandbox list

>>> [CLI] sandbox status my-project

id [SANDBOX_ID]
name my-project
status running
autostop 10m

6 changes: 6 additions & 0 deletions acceptance/cmd/sandbox/create/json/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$CLI sandbox create --name my-project $JSON_FLAGS > LOG.created
cat LOG.created

title "JSON creation retains text output, short default IDs and cached labels"
trace $CLI sandbox list | contains.py "*" > LOG.list
trace $CLI sandbox status my-project
5 changes: 5 additions & 0 deletions acceptance/cmd/sandbox/create/json/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EnvMatrix.JSON_FLAGS = ["--json", "-o json"]

[[Repls]]
Old = '[a-z]+-[a-z]+-[1-9][0-9]{3}'
New = '[SANDBOX_ID]'
6 changes: 3 additions & 3 deletions acceptance/cmd/sandbox/create/with-name/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
✓ Sandbox happy-panda-1234 is running
default happy-panda-1234
✓ Sandbox [SANDBOX_ID] is running
default [SANDBOX_ID]

happy-panda-1234
[SANDBOX_ID]
13 changes: 3 additions & 10 deletions acceptance/cmd/sandbox/create/with-name/test.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
[[Server]]
Pattern = "POST /api/2.0/lakebox/sandboxes"
Response.Body = '''
{
"sandboxId": "happy-panda-1234",
"status": "Running",
"name": "my-project",
"gatewayHost": "uw2.dbrx.dev"
}
'''
[[Repls]]
Old = '[a-z]+-[a-z]+-[1-9][0-9]{3}'
New = '[SANDBOX_ID]'
4 changes: 0 additions & 4 deletions acceptance/cmd/sandbox/default/not-found/test.toml

This file was deleted.

3 changes: 3 additions & 0 deletions acceptance/cmd/sandbox/default/set/sandbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"display_name": "my-project"
}
3 changes: 3 additions & 0 deletions acceptance/cmd/sandbox/default/set/script
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes?sandbox_id=happy-panda-1234 --json @sandbox.json > LOG.seed-0
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/sandboxes/happy-panda-1234 > LOG.ready-happy-panda-1234

$CLI sandbox default happy-panda-1234
9 changes: 0 additions & 9 deletions acceptance/cmd/sandbox/default/set/test.toml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"display_name": "my-project"
}
4 changes: 4 additions & 0 deletions acceptance/cmd/sandbox/delete/no-tty-no-auto-approve/script
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes?sandbox_id=happy-panda-1234 --json @sandbox.json > LOG.seed-0
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/sandboxes/happy-panda-1234 > LOG.ready-happy-panda-1234
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes/happy-panda-1234/stop > LOG.stop-0

# No --auto-approve and no TTY → must fail fast pointing at the flag,
# not hang on a read from a closed stdin.
musterr $CLI sandbox delete happy-panda-1234

This file was deleted.

4 changes: 0 additions & 4 deletions acceptance/cmd/sandbox/delete/not-found/test.toml

This file was deleted.

3 changes: 3 additions & 0 deletions acceptance/cmd/sandbox/delete/success/sandbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"display_name": "my-project"
}
4 changes: 4 additions & 0 deletions acceptance/cmd/sandbox/delete/success/script
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes?sandbox_id=happy-panda-1234 --json @sandbox.json > LOG.seed-0
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/sandboxes/happy-panda-1234 > LOG.ready-happy-panda-1234
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes/happy-panda-1234/stop > LOG.stop-0

$CLI sandbox delete happy-panda-1234 --auto-approve
13 changes: 0 additions & 13 deletions acceptance/cmd/sandbox/delete/success/test.toml

This file was deleted.

1 change: 1 addition & 0 deletions acceptance/cmd/sandbox/forward/forward/sandbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions acceptance/cmd/sandbox/forward/forward/script
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
MSYS_NO_PATHCONV=1 $CLI api post /api/2.0/sandboxes?sandbox_id=happy-panda-1234 --json @sandbox.json > LOG.seed-0
MSYS_NO_PATHCONV=1 $CLI api get /api/2.0/sandboxes/happy-panda-1234 > LOG.ready-happy-panda-1234

# Ports are allocated per run so that tests in parallel worktrees do not collide.
read -r LOCAL_PORT <<< "$(free_port.py 1)"

Expand Down
4 changes: 0 additions & 4 deletions acceptance/cmd/sandbox/forward/forward/test.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
RecordRequests = true
IncludeRequestHeaders = ["X-Databricks-Org-Id"]

[[Server]]
Pattern = "GET /api/2.0/lakebox/sandboxes/happy-panda-1234"
Response.Body = '{"sandboxId": "happy-panda-1234", "status": "Running"}'

[[Server]]
Pattern = "POST /sandbox-proxy/sandboxes/happy-panda-1234/ports/10080/{path...}"
Response.Body = 'hello from the sandbox app'
Expand Down
4 changes: 0 additions & 4 deletions acceptance/cmd/sandbox/forward/not-found/test.toml

This file was deleted.

1 change: 1 addition & 0 deletions acceptance/cmd/sandbox/lifecycle/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
171 changes: 171 additions & 0 deletions acceptance/cmd/sandbox/lifecycle/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@

>>> [CLI] sandbox status [SANDBOX_ID] --json
{
"name": "sandboxes/[SANDBOX_ID]",
"display_name": "my-project-[UNIQUE_NAME]",
"status": {
"state": "SANDBOX_STATE_RUNNING"
},
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
}
}

>>> [CLI] sandbox config [SANDBOX_ID] --idle-timeout 15m

id [SANDBOX_ID]
name my-project-[UNIQUE_NAME]
autostop 15m


>>> [CLI] sandbox config [SANDBOX_ID] --name renamed-project-[UNIQUE_NAME]

id [SANDBOX_ID]
name renamed-project-[UNIQUE_NAME]
autostop 15m


>>> [CLI] sandbox config [SANDBOX_ID] --no-autostop

id [SANDBOX_ID]
name renamed-project-[UNIQUE_NAME]
autostop never


>>> [CLI] sandbox config [SANDBOX_ID] --no-autostop=false

id [SANDBOX_ID]
name renamed-project-[UNIQUE_NAME]
autostop 10m


>>> [CLI] sandbox stop [SANDBOX_ID]
✓ Stopped [SANDBOX_ID]
{
"name": "sandboxes/[SANDBOX_ID]",
"display_name": "renamed-project-[UNIQUE_NAME]",
"status": {
"state": "SANDBOX_STATE_STOPPED"
},
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
}
}

>>> [CLI] sandbox start [SANDBOX_ID]
✓ Started [SANDBOX_ID]

>>> [CLI] sandbox start [SANDBOX_ID]
✓ Already running [SANDBOX_ID]

>>> retry --until "sandboxes/[SANDBOX_ID]" [CLI] sandbox list --json
[
{
"name": "sandboxes/[SANDBOX_ID]",
"display_name": "renamed-project-[UNIQUE_NAME]",
"status": {
"state": "SANDBOX_STATE_RUNNING"
},
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
}
}
]

>>> [CLI] sandbox delete [SANDBOX_ID] --auto-approve
✓ Removed [SANDBOX_ID] (default cleared)

>>> retry --until-not "sandboxes/[SANDBOX_ID]" [CLI] sandbox list --json
[]

>>> musterr [CLI] sandbox status [SANDBOX_ID]
Error: no sandbox named "[SANDBOX_ID]" — `databricks sandbox list` shows available IDs

>>> print_requests.py //sandboxes
{
"method": "POST",
"path": "/api/2.0/sandboxes",
"q": {
"sandbox_id": "[SANDBOX_ID]"
},
"body": {
"display_name": "my-project-[UNIQUE_NAME]",
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
}
}
}
{
"method": "PATCH",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]",
"q": {
"update_mask": "spec.compute.inactivity_timeout"
},
"body": {
"spec": {
"compute": {
"inactivity_timeout": "900s"
}
}
}
}
{
"method": "PATCH",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]",
"q": {
"update_mask": "display_name"
},
"body": {
"display_name": "renamed-project-[UNIQUE_NAME]"
}
}
{
"method": "PATCH",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]",
"q": {
"update_mask": "spec.compute.inactivity_timeout"
},
"body": {
"spec": {
"compute": {
"inactivity_timeout": "0s"
}
}
}
}
{
"method": "PATCH",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]",
"q": {
"update_mask": "spec.compute.inactivity_timeout"
},
"body": {
"spec": {
"compute": {
"inactivity_timeout": "600s"
}
}
}
}
{
"method": "POST",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]/stop",
"body": {}
}
{
"method": "POST",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]/start",
"body": {}
}
{
"method": "DELETE",
"path": "/api/2.0/sandboxes/[SANDBOX_ID]"
}
Loading
Loading