Skip to content

Conversation

@shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Dec 18, 2025

Changes

Updates bundle generate to use the filer abstraction for writing files instead of direct filesystem operations. This fixes the databricks bundle generate --bind command when run on DBR.

In a follow-up, we can consider adding support for using FUSE instead if the DBR version is appropriate (16.4+, 2+ on serverless). I verfied that FUSE works now and gives the expected semantics necessary to write notebooks. Actually using FUSE is out of scope for this PR.

Note: Because we use BundleRootPath as the root of the file, there is a small regression where people will not be able to generate outside their bundle root (but still in their sync root).

In general generate is only meant to be run in a single bundle and is not support to create resources that are shared across bundles, so I've kept this in and am not using SyncRoot as the root of the filer (which would involve a slight refactor).

Tests

  • Added unit tests for filer.NewOutputFiler covering local, DBR with non-workspace path, and DBR with workspace path scenarios
  • Existing unit tests pass
  • Manually verified that generate works on DBR now. Bundle init continues to work.

@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Dec 18, 2025

Commit: 56da42f

Run: 20777648111

Env ❌​FAIL 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 11 9 2 381 671 338:57
🟨​ aws windows 16 4 2 383 669 75:30
🟨​ aws-ucws linux 11 9 2 532 548 338:05
❌​ aws-ucws windows 1 16 4 2 533 546 74:17
🟨​ azure linux 2 5 8 3 381 670 190:30
🟨​ azure windows 15 3 383 668 63:44
🟨​ azure-ucws windows 15 3 530 545 80:16
🟨​ gcp linux 2 2 11 3 370 676 24:11
🟨​ gcp windows 7 2 6 3 372 674 24:08
23 interesting tests: 17 KNOWN, 4 RECOVERED, 1 SKIP, 1 FAIL
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 🟨​K 🟨​K 💚​R 🟨​K 🟨​K 🔄​f 🔄​f
🟨​ TestAccept/bundle/deployment/bind/alert 🙈​S 🙈​S 🙈​S 🙈​S 🔄​f 🟨​K 🟨​K 🔄​f 🔄​f
🟨​ TestAccept/bundle/resources/alerts/basic 🟨​K 🟨​K 🟨​K 🟨​K 💚​R 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/alerts/basic/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 🟨​K 🟨​K 🔄​f 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/alerts/basic/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 🟨​K 🟨​K 🔄​f 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/alerts/with_file 🟨​K 🟨​K 🟨​K 🟨​K 💚​R 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/alerts/with_file/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 🟨​K 🟨​K 🔄​f 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/alerts/with_file/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 🟨​K 🟨​K 🔄​f 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 🟨​K 🟨​K 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 🟨​K 🟨​K
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
❌​ TestAccept/ssh/connection ✅​p ✅​p ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
🟨​ TestExport 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestExportWithFileFlag 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K
🟨​ TestImportDir 💚​R 🟨​K 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 🟨​K
🟨​ TestImportDirDoesNotOverwrite 💚​R 🟨​K 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 🟨​K
🟨​ TestImportDirWithOverwriteFlag 💚​R 🟨​K 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 🟨​K
🟨​ TestImportFileFormatAuto 💚​R 🟨​K 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 🟨​K
🟨​ TestImportFileFormatSource 💚​R 🟨​K 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 🟨​K
Top 17 slowest tests (at least 2 minutes):
duration env testname
48:25 azure linux TestAccept/bundle/resources/alerts/basic/DATABRICKS_BUNDLE_ENGINE=terraform
8:02 aws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
7:32 aws-ucws windows TestAccept/bundle/resources/synced_database_tables/basic
6:26 aws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
6:24 aws-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
6:12 aws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:49 aws-ucws linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:45 gcp windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:38 aws-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
5:23 aws-ucws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:22 aws-ucws linux TestAccept/bundle/resources/synced_database_tables/basic
5:08 gcp linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
5:07 gcp windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
4:44 gcp linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct
2:49 azure-ucws windows TestAccept/bundle/resources/synced_database_tables/basic
2:35 aws windows TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform
2:00 azure linux TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform

:Q
erge remote-tracking branch 'origin' into fix-fuse-generate
Comment on lines +18 to +19
// This function ensures the correct filer is used based on the runtime environment.
func NewOutputFiler(ctx context.Context, w *databricks.WorkspaceClient, outputDir string) (Filer, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is specific to DBR, can you move to libs/dbr?

func testContext(t *testing.T) context.Context {
m := mocks.NewMockWorkspaceClient(t)
ctx := cmdctx.SetWorkspaceClient(context.Background(), m.WorkspaceClient)
return dbr.DetectRuntime(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

This evaluates differently on DBR and non-DBR. If for testing purposes, can it be fixed?

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

This PR uncovered another issue on DBR. Blocking merge.

@shreyas-goenka
Copy link
Contributor Author

This approach is no longer needed. We need to add a parser for the DBR version instead.

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.

4 participants