Skip to content

WIP new migration#5399

Draft
denik wants to merge 11 commits into
mainfrom
denik/new-migration
Draft

WIP new migration#5399
denik wants to merge 11 commits into
mainfrom
denik/new-migration

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented Jun 1, 2026

Changes

Why

Tests

@denik denik temporarily deployed to test-trigger-is June 1, 2026 15:27 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 1, 2026 15:27 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

eng-dev-ecosystem-bot commented Jun 1, 2026

Commit: 7636ff9

Run: 27035818347

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 15 261 923 7:11
🟨​ aws windows 7 15 263 921 12:40
💚​ aws-ucws linux 7 15 357 837 6:46
💚​ aws-ucws windows 7 15 359 835 9:03
💚​ azure linux 1 17 264 921 6:18
💚​ azure windows 1 17 266 919 9:51
💚​ azure-ucws linux 1 17 362 833 6:51
💚​ azure-ucws windows 1 17 364 831 8:48
💚​ gcp linux 1 17 260 924 6:32
💚​ gcp windows 1 17 262 922 10:53
22 interesting tests: 15 SKIP, 7 KNOWN
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​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 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​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 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/grants/select 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 24 slowest tests (at least 2 minutes):
duration env testname
4:41 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:36 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:35 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:25 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
4:13 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:50 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:43 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:32 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:32 gcp windows TestAccept
3:26 azure windows TestAccept
3:18 azure-ucws windows TestAccept
3:18 aws-ucws windows TestAccept
3:15 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:13 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:08 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:03 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:02 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:57 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:55 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:55 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:50 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:39 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:38 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:38 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform

@denik denik temporarily deployed to test-trigger-is June 2, 2026 12:12 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 2, 2026 12:12 — with GitHub Actions Inactive
@denik denik force-pushed the denik/new-migration branch from 13572c4 to 82112d7 Compare June 2, 2026 19:14
@denik denik temporarily deployed to test-trigger-is June 2, 2026 19:14 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 2, 2026 19:14 — with GitHub Actions Inactive
@denik denik force-pushed the denik/new-migration branch from 82112d7 to 969c201 Compare June 4, 2026 09:41
@denik denik temporarily deployed to test-trigger-is June 4, 2026 09:42 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 09:42 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 09:51 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 09:51 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 10:09 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 10:09 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 10:55 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 10:55 — with GitHub Actions Inactive
@denik denik force-pushed the denik/new-migration branch from d9d854f to f9471b6 Compare June 4, 2026 11:06
@denik denik temporarily deployed to test-trigger-is June 4, 2026 11:06 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 4, 2026 11:06 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 13:02 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 13:02 — with GitHub Actions Inactive
@denik denik force-pushed the denik/new-migration branch from fbe207c to 8a1ad59 Compare June 5, 2026 14:48
@denik denik temporarily deployed to test-trigger-is June 5, 2026 14:49 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 14:49 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 15:09 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 15:09 — with GitHub Actions Inactive
denik added 3 commits June 5, 2026 17:48
Implement a new `bundle migrate` command that creates the direct state file
from local config + Terraform state attributes, without making any API calls.
Unlike `bundle deployment migrate` which calls DoRead for each resource, this
command reads resolved field values directly from the local TF state file.

Cross-resource references (e.g. ${resources.jobs.src.git_source[0].branch})
are resolved using two independent methods and the results reconciled:
- Method A: look up the field in the TF state of the resource that contains
  the reference (e.g. read name from databricks_job.dst TF attributes).
- Method B: evaluate the template by reading each ${resources.*} reference
  from the TF state of the referenced resource and interpolating.

If both methods agree, the value is used silently. If only one succeeds, that
value is used. If both succeed but disagree, the longer string is used with a
warning. If both fail, an error is returned.

The bundle/migrate package provides:
- ParseTFStateAttrs: parses the full TF state file (all resource attributes)
- LookupTFField: looks up a field value using DABsPathToTerraform translation
- ResolveFieldRef: reconciles Methods A and B for a single field

Co-authored-by: Isaac
The new migrate command reads only from the local TF state file and never
invokes the Terraform engine, so a pre-migration plan check has no place here.
The --noplancheck flag is kept but ignored to avoid breaking callers.

Co-authored-by: Isaac
…/migrate

MigrateMode was a bool parameter on Apply that forked between "save state
without deploying" and "actually deploy". The two MigrateMode(true) callers
(bundle deployment migrate and upload_state_for_yaml_sync) now use
migrate.BuildStateFromTF directly, reading from the local TF state file
without any API calls.

Changes:
- New bundle/migrate/build_state.go: public BuildStateFromTF extracted from
  cmd/bundle/migrate.go, taking *config.Root so callers can pass an
  un-interpolated config (needed by upload_state_for_yaml_sync).
- bundle/direct/bundle_apply.go: drop MigrateMode type and parameter; Apply
  now only handles real deployments.
- bundle/phases/{deploy,destroy}.go: drop MigrateMode(false) argument.
- upload_state_for_yaml_sync.go: replace CalculatePlan+Apply with
  BuildStateFromTF; keep reverseInterpolate since config is TF-interpolated.
- cmd/bundle/deployment/migrate.go: replace CalculatePlan+Apply with
  BuildStateFromTF; drop exported RunPlanCheck/GetCommonArgs wrappers.
- cmd/bundle/migrate.go: delegate to migrate.BuildStateFromTF.

Co-authored-by: Isaac
denik added 7 commits June 5, 2026 17:48
The new approach (BuildStateFromTF, no API calls) has been folded into the
existing 'bundle deployment migrate' command. The separate 'bundle migrate'
command is removed — it was redundant.

Also add resolve_test.go: verify that int and bool cross-resource references
work correctly when Method B returns a string value. structaccess.Set already
handles string→int and string→bool conversion via strconv, so no bug exists.

Co-authored-by: Isaac
The command now reads from the local TF state file without invoking the
Terraform binary, so there is nothing for the plan check to verify.
Also simplify getCommonArgs to return only the display string (the args
slice was only needed to forward to the plan subprocess).

Co-authored-by: Isaac
Remove --noplancheck from expected output after dropping that flag.

Co-authored-by: Isaac
… update outputs

TF state stores single-block fields (e.g. continuous, deployment) as
single-element arrays [{}], not plain objects. json.Unmarshal into the
generated Go schema structs fails with type mismatch. Switch LookupTFField
to navigate via map[string]any + custom navigateTFState that auto-unwraps
single-element lists when a string-key step follows.

Also:
- Restore --noplancheck as a no-op flag (backward compat; used by invariant
  tests for job_with_depends_on config).
- Remove the plan-check lines from acceptance test output.txt files.
- Update help output to include --noplancheck.

Co-authored-by: Isaac
…lancheck

The refs map is shared with sv.Refs and gets mutated (entries deleted) during
reference resolution. depends_on must be computed before that loop runs.

Also restore --noplancheck as a no-op flag kept for backward compatibility
(used by the invariant test suite for job_with_depends_on config).

Co-authored-by: Isaac
…lias

Two categories of field lookup failures in LookupTFField:

1. Postgres resources (postgres_projects, postgres_branches, etc.) use a 'spec'
   wrapper via DABsToTerraformWrappers, but some fields like 'name' are at the
   TF state root, not under spec. When the spec-prefixed path fails, retry with
   the original unwrapped path.

2. Model permissions reference 'model_id' (the numeric model ID) which TF stores
   as 'registered_model_id'. Add a tfStateFieldAliases map for such state-only
   field name mismatches.

Also update acceptance output files:
- default-python: remove musterr/--noplancheck pattern; the plan check that made
  the first migrate call fail no longer exists, so just call migrate once.
- runas: remove plan-check output lines that appeared before 'Success!'.

Co-authored-by: Isaac
@denik denik force-pushed the denik/new-migration branch from 6cd9860 to c8f326f Compare June 5, 2026 15:49
@denik denik temporarily deployed to test-trigger-is June 5, 2026 15:49 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 15:49 — with GitHub Actions Inactive
Tests cover:
- Basic job stored with correct ID
- Resource absent from TF state is skipped
- Cross-resource string ref: depends_on computed, field resolved from TF state
- Cross-resource numeric ref: int value stored as number not string
- Dashboard etag stored from etags map

Co-authored-by: Isaac
@denik denik temporarily deployed to test-trigger-is June 5, 2026 19:31 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is June 5, 2026 19:31 — with GitHub Actions Inactive
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