Skip to content

Commit 4332aa0

Browse files
authored
feat: New apps commands (#4247)
## Changes ### Overview This PR adds new AppKit development commands to `databricks apps`, making them first-class citizens alongside the auto-generated Apps API commands. The implementation follows the same pattern established by the `pipelines` commands. ### New Command Structure `databricks apps` now has three command groups: | Group | Commands | Description | |-------|----------|-------------| | **Available Commands** | `deploy`, `dev-remote`, `init`, `logs`, `run-local`, `validate` | Custom development commands | | **Management Commands** | `create`, `delete`, `get`, `list`, `start`, `stop`, etc. | Auto-generated API commands | | **Permission Commands** | `get-permissions`, `set-permissions`, etc. | Permission management | ### Key Features 1. `databricks apps init` - Initialize new AppKit projects from templates with interactive prompts, but also allowing full prompt override via flags. 2. `databricks apps dev-remote` - Run local Vite dev server with WebSocket bridge to remote app (this command already exists, but now has some improvements like deriving the project from the folder and reconnecting). 3. `databricks apps validate` - Run validation of the app running type checking, linting and building. 4. `databricks apps deploy` - Dual-mode deployment: - Bundle mode (when databricks.yml exists): Validates → Deploys bundle → Runs app - API mode: Standard API deployment with APP_NAME argument ### Directory Structure ``` cmd/apps/ # Custom commands ├── apps.go # Commands() + ManagementGroupID ├── init.go # Initialize projects ├── dev.go # Dev-remote command ├── deploy_bundle.go # Bundle-aware deploy ├── logs.go # App logs ├── run_local.go # Run locally └── validate.go # Validate the project compiles cmd/workspace/apps/ # Auto-generated + overrides ├── apps.go # SDK commands ├── overrides.go # Imports cmd/apps, groups commands └── errors.go # Error handling libs/apps/ # Shared libraries ├── features/ # Feature definitions ├── prompt/ # Interactive prompts ├── validation/ # Project validation └── vite/ # Vite bridge ``` ## Why <!-- Why are these changes needed? Provide the context that the reviewer might be missing. For example, were there any decisions behind the change that are not reflected in the code itself? --> ## Tests <!-- How have you tested the changes? --> <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. --> --------- Co-authored-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
1 parent 92646b7 commit 4332aa0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4173
-274
lines changed

NOTICE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ charmbracelet/bubbletea - https://github.com/charmbracelet/bubbletea
8282
Copyright (c) 2020-2025 Charmbracelet, Inc
8383
License - https://github.com/charmbracelet/bubbletea/blob/master/LICENSE
8484

85+
charmbracelet/huh - https://github.com/charmbracelet/huh
86+
Copyright (c) 2023 Charmbracelet, Inc.
87+
License - https://github.com/charmbracelet/huh/blob/main/LICENSE
88+
8589
charmbracelet/lipgloss - https://github.com/charmbracelet/lipgloss
8690
Copyright (c) 2021-2025 Charmbracelet, Inc
8791
License - https://github.com/charmbracelet/lipgloss/blob/master/LICENSE
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Minimal app for testing
2+
print("Hello from app")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources:
5+
apps:
6+
myapp:
7+
name: myapp
8+
source_code_path: ./app

acceptance/apps/deploy/bundle-no-args/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
>>> [CLI] apps deploy --skip-validation
3+
Deploying bundle...
4+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
5+
Deploying resources...
6+
Updating deployment state...
7+
Deployment complete!
8+
✓ Getting the status of the app myapp
9+
✓ App is in RUNNING state
10+
✓ App compute is in ACTIVE state
11+
✓ Deployment succeeded
12+
You can access the app at myapp-123.cloud.databricksapps.com
13+
✔ Deployment complete!
14+
15+
>>> [CLI] bundle destroy --auto-approve
16+
The following resources will be deleted:
17+
delete resources.apps.myapp
18+
19+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
20+
21+
Deleting files...
22+
Destroy complete!
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Test: apps deploy in a bundle directory without APP_NAME
2+
# Expected: Bundle deploy flow with validation + deploy + run app
3+
# Using --skip-validation since we're testing the deploy flow, not validation
4+
5+
trace $CLI apps deploy --skip-validation
6+
7+
trace $CLI bundle destroy --auto-approve
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Local = true
2+
Cloud = false
3+
4+
Ignore = [
5+
'.databricks',
6+
]
7+
8+
[EnvMatrix]
9+
DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"]
10+
11+
[[Server]]
12+
Pattern = "POST /api/2.0/apps/myapp/deployments"
13+
Response.Body = '''
14+
{
15+
"deployment_id": "dep-123",
16+
"source_code_path": "/Workspace/apps/myapp",
17+
"mode": "SNAPSHOT",
18+
"status": {
19+
"state": "SUCCEEDED",
20+
"message": "Deployment succeeded"
21+
}
22+
}
23+
'''
24+
25+
[[Server]]
26+
Pattern = "GET /api/2.0/apps/myapp/deployments/dep-123"
27+
Response.Body = '''
28+
{
29+
"deployment_id": "dep-123",
30+
"source_code_path": "/Workspace/apps/myapp",
31+
"mode": "SNAPSHOT",
32+
"status": {
33+
"state": "SUCCEEDED",
34+
"message": "Deployment succeeded"
35+
}
36+
}
37+
'''
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources:
5+
apps:
6+
myapp:
7+
name: myapp
8+
source_code_path: .
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/apps/test-app/deployments",
4+
"body": {}
5+
}

acceptance/apps/deploy/bundle-with-appname/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)