Skip to content

Commit 348c284

Browse files
authored
Clearly mark error and success in migrate command (#4118)
1 parent 685e28d commit 348c284

File tree

9 files changed

+13
-12
lines changed

9 files changed

+13
-12
lines changed

acceptance/bundle/migrate/basic/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
>>> musterr [CLI] bundle deployment migrate
3-
This command migrates the existing Terraform state file (terraform.tfstate) to a direct deployment state file (resources.json). However, no existing local or remote state was found.
3+
Error: This command migrates the existing Terraform state file (terraform.tfstate) to a direct deployment state file (resources.json). However, no existing local or remote state was found.
44

55
To start using direct engine, deploy with DATABRICKS_BUNDLE_ENGINE=direct env var set.
66

@@ -13,7 +13,7 @@ Deployment complete!
1313
>>> [CLI] bundle deployment migrate
1414
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
1515
Plan: 0 to add, 0 to change, 0 to delete, 3 unchanged
16-
Migrated 3 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/dev/resources.json
16+
Success! Migrated 3 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/dev/resources.json
1717

1818
Validate the migration by running "databricks bundle plan", there should be no actions planned.
1919

acceptance/bundle/migrate/dashboards/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deployment complete!
88
>>> [CLI] bundle deployment migrate
99
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
1010
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
11-
Migrated 1 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
11+
Success! Migrated 1 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
1212

1313
Validate the migration by running "databricks bundle plan", there should be no actions planned.
1414

acceptance/bundle/migrate/default-python/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Error: 'databricks bundle plan' shows actions planned, aborting migration. Pleas
3333

3434
>>> [CLI] bundle deployment migrate --noplancheck
3535
Building python_artifact...
36-
Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/my_default_python/.databricks/bundle/dev/resources.json
36+
Success! Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/my_default_python/.databricks/bundle/dev/resources.json
3737

3838
Validate the migration by running "databricks bundle plan", there should be no actions planned.
3939

acceptance/bundle/migrate/grants/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deployment complete!
88
>>> [CLI] bundle deployment migrate
99
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
1010
Plan: 0 to add, 0 to change, 0 to delete, 6 unchanged
11-
Migrated 6 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
11+
Success! Migrated 6 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
1212

1313
Validate the migration by running "databricks bundle plan", there should be no actions planned.
1414

acceptance/bundle/migrate/permissions/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deployment complete!
88
>>> [CLI] bundle deployment migrate
99
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
1010
Plan: 0 to add, 0 to change, 0 to delete, 4 unchanged
11-
Migrated 4 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
11+
Success! Migrated 4 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/default/resources.json
1212

1313
Validate the migration by running "databricks bundle plan", there should be no actions planned.
1414

acceptance/bundle/migrate/profile_arg/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deployment complete!
88
>>> [CLI] bundle deployment migrate -p non_existent321
99
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
1010
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
11-
Migrated 1 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/dev/resources.json
11+
Success! Migrated 1 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/dev/resources.json
1212

1313
Validate the migration by running "databricks bundle plan -p non_existent321", there should be no actions planned.
1414

@@ -26,7 +26,7 @@ Deployment complete!
2626
>>> [CLI] bundle deployment migrate -p non_existent321 -t prod
2727
Note: Migration should be done after a full deploy. Running plan now to verify that deployment was done:
2828
Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged
29-
Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/prod/resources.json
29+
Success! Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/prod/resources.json
3030

3131
Validate the migration by running "databricks bundle plan -t prod -p non_existent321", there should be no actions planned.
3232

acceptance/bundle/migrate/runas/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ See https://docs.databricks.com/dev-tools/bundles/permissions.html to learn more
9595
in databricks.yml:5:3
9696

9797
Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged
98-
Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/production/resources.json
98+
Success! Migrated 2 resources to direct engine state file: [TEST_TMP_DIR]/.databricks/bundle/production/resources.json
9999

100100
Validate the migration by running "databricks bundle plan", there should be no actions planned.
101101

cmd/bundle/deployment/migrate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ WARNING: Both direct deployment engine and this command are experimental and not
136136

137137
if stateDesc.Lineage == "" {
138138
// TODO: mention bundle.engine once it's there
139-
cmdio.LogString(ctx, `This command migrates the existing Terraform state file (terraform.tfstate) to a direct deployment state file (resources.json). However, no existing local or remote state was found.
139+
cmdio.LogString(ctx, `Error: This command migrates the existing Terraform state file (terraform.tfstate) to a direct deployment state file (resources.json). However, no existing local or remote state was found.
140140
141141
To start using direct engine, deploy with DATABRICKS_BUNDLE_ENGINE=direct env var set.`)
142142
return root.ErrAlreadyPrinted
@@ -244,7 +244,7 @@ To start using direct engine, deploy with DATABRICKS_BUNDLE_ENGINE=direct env va
244244
logdiag.LogError(ctx, err)
245245
}
246246

247-
cmdio.LogString(ctx, fmt.Sprintf(`Migrated %d resources to direct engine state file: %s
247+
cmdio.LogString(ctx, fmt.Sprintf(`Success! Migrated %d resources to direct engine state file: %s
248248
249249
Validate the migration by running "databricks bundle plan%s", there should be no actions planned.
250250

docs/direct.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ There are known issues, see https://github.com/databricks/cli/issues?q=state%3Ao
3434

3535
### Migrating the existing deployment
3636

37-
The direct engine uses its own state file, also JSON, but with a different schema from terraform state file. In order to migrate an existing Terraform-based deployment, use the "bundle deployment migrate" command. The command reads IDs from the existing deployment.
37+
The direct engine uses its own state file, also JSON, but with a different schema from terraform state file.
38+
In order to migrate an existing Terraform-based deployment, use the `databricks bundle deployment migrate` command. The command reads IDs from the existing deployment.
3839

3940
The full sequence of operations:
4041

0 commit comments

Comments
 (0)