Skip to content

Add declarative bind for direct deployment engine#4630

Draft
shreyas-goenka wants to merge 14 commits intomainfrom
declarative-import
Draft

Add declarative bind for direct deployment engine#4630
shreyas-goenka wants to merge 14 commits intomainfrom
declarative-import

Conversation

@shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Mar 2, 2026

Summary

  • Add bind blocks to target configuration, allowing users to bind existing workspace resources (jobs, pipelines, etc.) into bundle management at deploy time
  • Support two bind action types: pure bind (no config changes) and bind_and_update (bind + apply changes)
  • Block bundle deployment migrate when bind blocks are defined, since they are only supported with the direct engine
  • Implement Bind as a dynamic map[string]map[string]BindResource type that automatically supports all resource types

Test plan

  • Acceptance test: basic bind of an existing job (acceptance/bundle/deploy/bind/basic)
  • Acceptance test: bind + update job name in same deploy (acceptance/bundle/deploy/bind/bind-and-update)
  • Acceptance test: migration blocked with bind blocks (acceptance/bundle/deploy/bind/block-migrate)
  • Acceptance test: error when binding non-existent resource (acceptance/bundle/deploy/bind/resource-not-found)
  • Acceptance test: orphaned bind detection (acceptance/bundle/deploy/bind/orphaned-bind)
  • Acceptance test: recreate blocked for bound resources (acceptance/bundle/deploy/bind/recreate-blocked)
  • Acceptance test: terraform engine rejects bind blocks (acceptance/bundle/deploy/bind/terraform-with-bind)
  • All tests pass locally and on cloud

🤖 Generated with Claude Code

Allow users to import existing workspace resources into bundle management
at deploy time using import blocks in target configuration. This is
analogous to Terraform's import blocks and enables taking over management
of resources without recreating them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eng-dev-ecosystem-bot
Copy link
Collaborator

eng-dev-ecosystem-bot commented Mar 2, 2026

Commit: 0146951

Run: 22982060953

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 8 7 268 793 5:25
🔄​ aws-ucws linux 2 8 7 363 708 8:11
🔄​ aws-ucws windows 2 7 7 366 706 6:40
💚​ azure linux 2 9 271 791 6:45
💚​ azure windows 2 9 273 789 5:32
🔄​ azure-ucws linux 2 1 9 369 704 8:56
🔄​ azure-ucws windows 2 1 9 371 702 5:10
💚​ gcp linux 2 9 267 794 5:35
💚​ gcp windows 2 9 269 792 5:32
18 interesting tests: 7 SKIP, 6 RECOVERED, 5 flaky
Test Name aws linux aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🔄​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f 🔄​f 💚​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 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestAccept/ssh/connect-serverless-gpu 🙈​s ✅​p 🔄​f 🙈​s 🙈​s 🔄​f 🔄​f 🙈​s 🙈​s
🔄​ TestAccept/ssh/connection 💚​R 💚​R 🔄​f 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestFilerWorkspaceNotebook ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p
🔄​ TestFilerWorkspaceNotebook/scalaNb.scala ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p
Top 18 slowest tests (at least 2 minutes):
duration env testname
3:51 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:51 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:39 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:33 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:23 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:20 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:17 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:10 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:09 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:56 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:42 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:41 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:36 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:20 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:18 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:14 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:12 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:08 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform

Add validations for:
- Import blocks used with terraform engine (must use direct engine)
- Import blocks referencing undefined resources (orphaned imports)

Add acceptance tests for:
- Recreate blocked for imported resources (changing immutable field)
- Orphaned import blocks (import references non-existent resource)
- Import blocks rejected with terraform engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shreyas-goenka shreyas-goenka marked this pull request as draft March 3, 2026 09:05
Rename the "import" configuration block to "bind" throughout the codebase
to better reflect the semantics of binding existing workspace resources
into bundle management.

Also refactor the Bind type from a hardcoded struct with 21 resource type
fields to a dynamic map[string]map[string]BindResource, reducing the
implementation from ~225 lines to ~42 lines and eliminating the need to
update the type when new resource types are added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shreyas-goenka shreyas-goenka changed the title Add declarative import for direct deployment engine Add declarative bind for direct deployment engine Mar 5, 2026
- Move Bind/BindAndUpdate below UpdateWithID but before Create/Recreate/Delete
  in the action severity order
- Add validation that prevents bind and delete conflicts on the same resource ID
- Add acceptance tests:
  - invalid-resource-type: bind references a non-existent resource type
  - top-level-bind: bind placed at root level instead of under target
  - delete-and-bind-conflict: bind ID matches a resource being deleted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace plain error messages with diag.Diagnostic that includes Locations
and Paths pointing to the bind block in the YAML config. Guard against
nil configRoot when called from destroy path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bind IDs that conflict with existing resources in state are invalid
regardless of the action type (delete, recreate, update_id, etc.).
Check all state entries directly instead of only delete plan entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test that binding a resource ID already managed by another resource in
state is caught, even when the existing resource is not being deleted.
This covers recreate and update_id conflict scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shreyas-goenka and others added 2 commits March 12, 2026 00:01
Two proposals:
1. Replace regex-based ${...} parsing with a proper two-mode character scanner
2. Add "did you mean?" suggestions for invalid variable references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extends the bind-and-update acceptance test to verify that the action
type transitions from "bind" on the first deploy to "update" on
subsequent deploys after the resource is already bound in state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two changes:

1. Destroy validation: bundle destroy now errors when bind blocks in the
   target configuration reference resources tracked in the deployment
   state. This prevents accidentally deleting pre-existing workspace
   resources that were imported via bind. Users must remove the bind
   blocks or run 'bundle deployment unbind' before destroying.

2. Bind plan logic: use an explicit switch on the max action type during
   bind planning. Only Update and Resize map to BindAndUpdate. Recreate
   and UpdateWithID produce user-facing errors. Any other action type
   (e.g. Create, Delete) is treated as an internal error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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