Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b2e6272
Added support for lifecycle.started option
andrewnester Mar 6, 2026
2cbff32
fixed sche,a
andrewnester Mar 6, 2026
5910d1c
some refactoring and fixed test output
andrewnester Mar 6, 2026
0c9ce97
fixed python codegene
andrewnester Mar 6, 2026
5ea3d6a
updated tests
andrewnester Mar 10, 2026
4a61282
fixed lifecycle check
andrewnester Mar 10, 2026
7fc5b46
introduce lifecyclewithstarted
andrewnester Mar 10, 2026
df48e08
fix test output
andrewnester Mar 10, 2026
464c1b8
fix tests
andrewnester Mar 11, 2026
34589cf
fixed starting clusters amnd sql warehouses
andrewnester Mar 16, 2026
93af424
fix required
andrewnester Mar 16, 2026
132ead9
also stop resources
andrewnester Mar 16, 2026
f9aee88
fixes
andrewnester Mar 16, 2026
6370d81
fix schemaa test
andrewnester Mar 16, 2026
67de29d
fixed tf output
andrewnester Mar 16, 2026
1e87fc5
remove clusters, sql_warehouses
andrewnester Mar 17, 2026
1b59197
revert clusters,sql_warehouse
andrewnester Mar 17, 2026
cb2af59
fix schema
andrewnester Mar 17, 2026
1b3d1a4
fix + fmt
andrewnester Mar 17, 2026
6580b5c
fix comment
andrewnester Mar 17, 2026
32480a6
fixed output
andrewnester Mar 17, 2026
db4cc35
fixed app test output
andrewnester Mar 17, 2026
88b4313
test app output
andrewnester Mar 17, 2026
b0a761a
addressed feedback
andrewnester Mar 20, 2026
fd81054
fix lint and test
andrewnester Mar 20, 2026
58b5fbe
lint
andrewnester Mar 20, 2026
ab3fdbb
fixed started field
andrewnester Mar 26, 2026
ecc3c70
fix
andrewnester Mar 26, 2026
90bf2d2
fixed lint
andrewnester Mar 26, 2026
197b576
fixed drift
andrewnester Mar 26, 2026
a596618
Merge branch 'main' into feat/lifecycle-started
andrewnester Mar 26, 2026
2d93e5f
fixed merged conflict
andrewnester Mar 26, 2026
9bf4eae
fix lint
andrewnester Mar 26, 2026
8c21f2d
addressed feedback
andrewnester Mar 27, 2026
7b39509
added test for changing config
andrewnester Mar 27, 2026
5494b19
update refschema
andrewnester Mar 27, 2026
f2b107b
fixed git_source test
andrewnester Mar 27, 2026
96425ad
fixes
andrewnester Mar 30, 2026
29d5c8a
fix lint
andrewnester Mar 30, 2026
b69bb16
Merge branch 'main' into feat/lifecycle-started
andrewnester Mar 30, 2026
beed2c5
fixed app update test
andrewnester Mar 30, 2026
fcbd2ec
fix for source_code_path drift
andrewnester Mar 30, 2026
b93f33f
fix migrate test
andrewnester Mar 30, 2026
ef5f09a
fix source_code_path no_drift test
andrewnester Mar 30, 2026
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
5 changes: 4 additions & 1 deletion acceptance/apps/deploy/bundle-no-args/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Updating deployment state...
Deployment complete!
✓ Getting the status of the app myapp
✓ App is in RUNNING state
✓ App compute is in ACTIVE state
✓ App compute is in STOPPED state
✓ Starting the app myapp
✓ App is starting...
✓ App is started!
✓ Deployment succeeded
You can access the app at myapp-123.cloud.databricksapps.com
✔ Deployment complete!
Expand Down
12 changes: 11 additions & 1 deletion acceptance/bundle/apps/git_source/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ Deploying resources...
Updating deployment state...
Deployment complete!

>>> [CLI] bundle run my_app
✓ Getting the status of the app [APP_NAME]
✓ App is in RUNNING state
✓ App compute is in STOPPED state
✓ Starting the app [APP_NAME]
✓ App is starting...
✓ App is started!
✓ Deployment succeeded.
You can access the app at [APP_NAME]-123.cloud.databricksapps.com

=== Get app details and verify git_source configuration
>>> [CLI] bundle summary --output json

Expand All @@ -45,7 +55,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
✓ Getting the status of the app [APP_NAME]
✓ App is in RUNNING state
✓ App compute is in ACTIVE state
✓ Deployment succeeded
✓ Deployment succeeded.
You can access the app at [APP_NAME]-123.cloud.databricksapps.com

=== Update git_source branch and redeploy
Expand Down
1 change: 1 addition & 0 deletions acceptance/bundle/apps/git_source/script
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ trace $CLI bundle plan

title "Deploy bundle"
trace $CLI bundle deploy
trace $CLI bundle run my_app > /dev/null || true
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 it expected to fail? the we should use my_app.

If it fails sometimes then I wonder what do we get from having this command in acceptance test?


title "Get app details and verify git_source configuration"
app_name=$(trace $CLI bundle summary --output json | jq -r '.resources.apps.my_app.name')
Expand Down
39 changes: 0 additions & 39 deletions acceptance/bundle/apps/git_source/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,3 @@ Ignore = [".databricks", "databricks.yml", "databricks.yml.bak", "tmp.app-run"]

# Apps can take longer to deploy
TimeoutCloud = "5m"

# Mock responses for app deployment
[[Server]]
Pattern = "POST /api/2.0/apps/{app_name}/deployments"
Response.Body = '''
{
"deployment_id": "test-deployment-123",
"status": {
"state": "SUCCEEDED",
"message": "Deployment succeeded"
},
"git_source": {
"branch": "main",
"source_code_path": "internal/testdata/simple-app",
"resolved_commit": "abc123def456"
},
"source_code_path": "/Workspace/Users/tester@databricks.com/.bundle/files/app",
"mode": "SNAPSHOT"
}
'''

[[Server]]
Pattern = "GET /api/2.0/apps/{app_name}/deployments/{deployment_id}"
Response.Body = '''
{
"deployment_id": "test-deployment-123",
"status": {
"state": "SUCCEEDED",
"message": "Deployment succeeded"
},
"git_source": {
"branch": "main",
"source_code_path": "internal/testdata/simple-app",
"resolved_commit": "abc123def456"
},
"source_code_path": "/Workspace/Users/tester@databricks.com/.bundle/files/app",
"mode": "SNAPSHOT"
}
'''
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run the app after the deploy otherwise migrate will show the drift on the source code path.
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.

This means that users of app will also experience drift until they do "run"?

Ideally we want to assert that right after deploy there is no drift.

Since it's a known behavior for this field, is it possible to account for it in resources.yml or in OverrideChangeDesc?

# This happens because source code path is set remotely only after the deploy.
$CLI bundle run foo
15 changes: 15 additions & 0 deletions acceptance/bundle/invariant/configs/app_lifecycle_ref.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bundle:
name: test-bundle-$UNIQUE_NAME

resources:
apps:
foo:
name: app-foo-$UNIQUE_NAME
source_code_path: ./app
lifecycle:
started: true
bar:
name: app-bar-$UNIQUE_NAME
source_code_path: ./app
lifecycle:
started: ${resources.apps.foo.lifecycle.started}
4 changes: 4 additions & 0 deletions acceptance/bundle/invariant/migrate/script
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ cat LOG.deploy | contains.py '!panic:' '!internal error' > /dev/null
echo INPUT_CONFIG_OK

trace $CLI bundle deployment migrate &> LOG.migrate
POST_DEPLOY_SCRIPT="$TESTDIR/../configs/$INPUT_CONFIG-post-deploy.sh"
if [ -f "$POST_DEPLOY_SCRIPT" ]; then
source "$POST_DEPLOY_SCRIPT" &> LOG.post_deploy
fi

cat LOG.migrate | contains.py '!panic:' '!internal error' > /dev/null

Expand Down
4 changes: 4 additions & 0 deletions acceptance/bundle/invariant/no_drift/script
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ trap cleanup EXIT

trace $CLI bundle deploy &> LOG.deploy
cat LOG.deploy | contains.py '!panic' '!internal error' > /dev/null
POST_DEPLOY_SCRIPT="$TESTDIR/../configs/$INPUT_CONFIG-post-deploy.sh"
if [ -f "$POST_DEPLOY_SCRIPT" ]; then
source "$POST_DEPLOY_SCRIPT" &> LOG.post_deploy
fi

# Special message to fuzzer that generated config was fine.
# Any failures after this point will be considered as "bug detected" by fuzzer.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello world\!")
16 changes: 16 additions & 0 deletions acceptance/bundle/lifecycle/started-validation/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bundle:
name: test_lifecycle_started_validation

resources:
jobs:
my_job:
name: my_job
lifecycle:
started: true

apps:
my_app:
name: my_app
source_code_path: ./app
lifecycle:
started: true
10 changes: 10 additions & 0 deletions acceptance/bundle/lifecycle/started-validation/out.direct.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

>>> errcode [CLI] bundle plan
Warning: unknown field: started
at resources.jobs.my_job.lifecycle
in databricks.yml:9:9

create apps.my_app
create jobs.my_job

Plan: 2 to add, 0 to change, 0 to delete, 0 unchanged
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

>>> errcode [CLI] bundle plan
Warning: unknown field: started
at resources.jobs.my_job.lifecycle
in databricks.yml:9:9

Error: lifecycle.started is only supported in direct deployment mode
in databricks.yml:16:18


Exit code: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
1 change: 1 addition & 0 deletions acceptance/bundle/lifecycle/started-validation/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace errcode $CLI bundle plan >> out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
4 changes: 4 additions & 0 deletions acceptance/bundle/lifecycle/started-validation/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ignore = [".databricks"]

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]
9 changes: 9 additions & 0 deletions acceptance/bundle/lifecycle/started/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bundle:
name: test_lifecycle_started

resources:
jobs:
my_job:
name: my_job
lifecycle:
started: true
5 changes: 5 additions & 0 deletions acceptance/bundle/lifecycle/started/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions acceptance/bundle/lifecycle/started/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Warning: unknown field: started
at resources.jobs.my_job.lifecycle
in databricks.yml:9:9

create jobs.my_job

Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
1 change: 1 addition & 0 deletions acceptance/bundle/lifecycle/started/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
errcode $CLI bundle plan
7 changes: 7 additions & 0 deletions acceptance/bundle/lifecycle/started/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Local = true
Cloud = false

Ignore = [".databricks"]

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct"]
39 changes: 21 additions & 18 deletions acceptance/bundle/refschema/out.fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ resources.apps.*.compute_status *apps.ComputeStatus ALL
resources.apps.*.compute_status.active_instances int ALL
resources.apps.*.compute_status.message string ALL
resources.apps.*.compute_status.state apps.ComputeState ALL
resources.apps.*.config *resources.AppConfig INPUT
resources.apps.*.config.command []string INPUT
resources.apps.*.config.command[*] string INPUT
resources.apps.*.config.env []resources.AppEnvVar INPUT
resources.apps.*.config.env[*] resources.AppEnvVar INPUT
resources.apps.*.config.env[*].name string INPUT
resources.apps.*.config.env[*].value string INPUT
resources.apps.*.config.env[*].value_from string INPUT
resources.apps.*.config *resources.AppConfig ALL
resources.apps.*.config.command []string ALL
resources.apps.*.config.command[*] string ALL
resources.apps.*.config.env []resources.AppEnvVar ALL
resources.apps.*.config.env[*] resources.AppEnvVar ALL
resources.apps.*.config.env[*].name string ALL
resources.apps.*.config.env[*].value string ALL
resources.apps.*.config.env[*].value_from string ALL
resources.apps.*.create_time string ALL
resources.apps.*.creator string ALL
resources.apps.*.default_source_code_path string ALL
Expand All @@ -112,18 +112,21 @@ resources.apps.*.effective_user_api_scopes[*] string ALL
resources.apps.*.git_repository *apps.GitRepository ALL
resources.apps.*.git_repository.provider string ALL
resources.apps.*.git_repository.url string ALL
resources.apps.*.git_source *apps.GitSource INPUT
resources.apps.*.git_source.branch string INPUT
resources.apps.*.git_source.commit string INPUT
resources.apps.*.git_source.git_repository *apps.GitRepository INPUT
resources.apps.*.git_source.git_repository.provider string INPUT
resources.apps.*.git_source.git_repository.url string INPUT
resources.apps.*.git_source.resolved_commit string INPUT
resources.apps.*.git_source.source_code_path string INPUT
resources.apps.*.git_source.tag string INPUT
resources.apps.*.git_source *apps.GitSource ALL
resources.apps.*.git_source.branch string ALL
resources.apps.*.git_source.commit string ALL
resources.apps.*.git_source.git_repository *apps.GitRepository ALL
resources.apps.*.git_source.git_repository.provider string ALL
resources.apps.*.git_source.git_repository.url string ALL
resources.apps.*.git_source.resolved_commit string ALL
resources.apps.*.git_source.source_code_path string ALL
resources.apps.*.git_source.tag string ALL
resources.apps.*.id string ALL
resources.apps.*.lifecycle *dresources.AppStateLifecycle REMOTE STATE
resources.apps.*.lifecycle *resources.LifecycleWithStarted INPUT
resources.apps.*.lifecycle resources.Lifecycle INPUT
resources.apps.*.lifecycle.prevent_destroy bool INPUT
resources.apps.*.lifecycle.started *bool ALL
resources.apps.*.modified_status string INPUT
resources.apps.*.name string ALL
resources.apps.*.oauth2_app_client_id string ALL
Expand Down Expand Up @@ -197,7 +200,7 @@ resources.apps.*.resources[*].uc_securable.securable_type apps.AppResourceUcSecu
resources.apps.*.service_principal_client_id string ALL
resources.apps.*.service_principal_id int64 ALL
resources.apps.*.service_principal_name string ALL
resources.apps.*.source_code_path string INPUT
resources.apps.*.source_code_path string ALL
resources.apps.*.space string ALL
resources.apps.*.telemetry_export_destinations []apps.TelemetryExportDestination ALL
resources.apps.*.telemetry_export_destinations[*] apps.TelemetryExportDestination ALL
Expand Down
1 change: 1 addition & 0 deletions acceptance/bundle/resources/apps/config-drift/app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello world!")
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bundle:
name: config-drift-$UNIQUE_NAME

resources:
apps:
myapp:
name: $UNIQUE_NAME
description: my_app
source_code_path: ./app
config:
command:
- python
- app.py
env:
- name: MY_VAR
value: original_value
lifecycle:
started: true
Loading
Loading