Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions acceptance/bundle/dms/declined-deploy/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"state": "{\"state\":{\"catalog_name\":\"main\",\"name\":\"dms_declined_deploy_schema\"}}",
"error_message": "",
"resource_id": "main.dms_declined_deploy_schema",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "{\"state\":{\"catalog_name\":\"main\",\"name\":\"dms_declined_deploy_schema\"}}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
Expand Down
14 changes: 8 additions & 6 deletions acceptance/bundle/dms/depends-on/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-depends-on/default/state/metadata.json\",\"version_id\":\"1\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"parent\",\"queue\":{\"enabled\":true}}}",
"error_message": "",
"resource_id": "[NUMID]",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-depends-on/default/state/metadata.json\",\"version_id\":\"1\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"parent\",\"queue\":{\"enabled\":true}}}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
Expand All @@ -28,10 +29,11 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-depends-on/default/state/metadata.json\",\"version_id\":\"1\"},\"description\":\"depends on [NUMID]\",\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"child\",\"queue\":{\"enabled\":true}},\"depends_on\":[{\"node\":\"resources.jobs.parent\",\"label\":\"${resources.jobs.parent.id}\"}]}",
"error_message": "",
"resource_id": "[NUMID]",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-depends-on/default/state/metadata.json\",\"version_id\":\"1\"},\"description\":\"depends on [NUMID]\",\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"child\",\"queue\":{\"enabled\":true}},\"depends_on\":[{\"node\":\"resources.jobs.parent\",\"label\":\"${resources.jobs.parent.id}\"}]}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}

Expand Down
20 changes: 12 additions & 8 deletions acceptance/bundle/dms/emptied-resource/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"state": "{\"state\":{\"catalog_name\":\"main\",\"name\":\"dms_emptied_resource\"}}",
"error_message": "",
"resource_id": "main.dms_emptied_resource",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "{\"state\":{\"catalog_name\":\"main\",\"name\":\"dms_emptied_resource\"}}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
Expand All @@ -63,10 +64,11 @@ Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"state": "{\"state\":{\"securable_type\":\"schema\",\"full_name\":\"main.dms_emptied_resource\",\"__embed__\":[{\"principal\":\"someone@example.com\",\"privileges\":[\"USE_SCHEMA\"]}]},\"depends_on\":[{\"node\":\"resources.schemas.foo\",\"label\":\"${resources.schemas.foo.id}\"}]}",
"error_message": "",
"resource_id": "schema/main.dms_emptied_resource",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "{\"state\":{\"securable_type\":\"schema\",\"full_name\":\"main.dms_emptied_resource\",\"__embed__\":[{\"principal\":\"someone@example.com\",\"privileges\":[\"USE_SCHEMA\"]}]},\"depends_on\":[{\"node\":\"resources.schemas.foo\",\"label\":\"${resources.schemas.foo.id}\"}]}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
Expand Down Expand Up @@ -118,9 +120,11 @@ Resources: 0 created, 1 changed, 0 deleted, 1 unchanged
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"error_message": "",
"resource_id": "schema/main.dms_emptied_resource",
"status": "OPERATION_STATUS_SUCCEEDED",
"sequence_id": "0"
"sequence_id": "0",
"state": "",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
Expand Down
2 changes: 1 addition & 1 deletion acceptance/bundle/dms/existing-state/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
>>> print_requests.py --dms //api/2.0/bundle --oneline
{"method": "POST", "path": "/api/2.0/bundle/deployments", "body": {"initial_parent_path": "/Workspace/Users/[USERNAME]/.bundle/dms-existing-state/default/state", "target_name": "default"}}
{"method": "POST", "path": "/api/2.0/bundle/deployments/[NUMID]/versions", "q": {"version_id": "1"}, "body": {"cli_version": "[CLI_VERSION]", "version_type": "VERSION_TYPE_DEPLOY", "target_name": "default", "display_name": "dms-existing-state", "workspace_info": {"file_path": "/Workspace/Users/[USERNAME]/.bundle/dms-existing-state/default/files", "root_path": "/Workspace/Users/[USERNAME]/.bundle/dms-existing-state/default"}, "operations": [{"resource_key": "jobs.one", "action_type": "OPERATION_ACTION_TYPE_CREATE"}]}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.one", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-existing-state/default/state/metadata.json\",\"version_id\":\"1\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"one\",\"queue\":{\"enabled\":true}}}", "resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.one", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-existing-state/default/state/metadata.json\",\"version_id\":\"1\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"one\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
{"method": "POST", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
10 changes: 10 additions & 0 deletions acceptance/bundle/dms/failed-delete/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bundle:
name: dms-failed-delete

experimental:
record_deployment_history: true

resources:
jobs:
stuck:
name: stuck
3 changes: 3 additions & 0 deletions acceptance/bundle/dms/failed-delete/out.test.toml

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

150 changes: 150 additions & 0 deletions acceptance/bundle/dms/failed-delete/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

=== Deploy: the job is recorded
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/files...
Created jobs.stuck
Files: 5 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py --dms //api/2.0/bundle
{
"method": "POST",
"path": "/api/2.0/bundle/deployments",
"body": {
"initial_parent_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/state",
"target_name": "default"
}
}
{
"method": "POST",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions",
"q": {
"version_id": "1"
},
"body": {
"cli_version": "[CLI_VERSION]",
"version_type": "VERSION_TYPE_DEPLOY",
"target_name": "default",
"display_name": "dms-failed-delete",
"workspace_info": {
"file_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/files",
"root_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default"
},
"operations": [
{
"resource_key": "jobs.stuck",
"action_type": "OPERATION_ACTION_TYPE_CREATE"
}
]
}
}
{
"method": "PATCH",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.stuck",
"q": {
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"error_message": "",
"resource_id": "[NUMID]",
"sequence_id": "0",
"state": "{\"state\":{\"deployment\":{\"deployment_id\":\"[NUMID]\",\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/state/metadata.json\",\"version_id\":\"1\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"stuck\",\"queue\":{\"enabled\":true}}}",
"status": "OPERATION_STATUS_SUCCEEDED"
}
}
{
"method": "POST",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/complete",
"body": {
"completion_reason": "VERSION_COMPLETE_SUCCESS"
}
}

=== A resource that fails to delete is recorded as a failed operation carrying the error, so the history says why rather than showing the resource gone
>>> musterr [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.jobs.stuck

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default

Error: cannot delete resources.jobs.stuck: deleting id=[NUMID]: job is not deletable (400 INVALID_PARAMETER_VALUE)

Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/delete
HTTP Status: 400 Bad Request
API error_code: INVALID_PARAMETER_VALUE
API message: job is not deletable


>>> print_requests.py --dms //api/2.0/bundle
{
"method": "POST",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions",
"q": {
"version_id": "2"
},
"body": {
"cli_version": "[CLI_VERSION]",
"version_type": "VERSION_TYPE_DESTROY",
"target_name": "default",
"display_name": "dms-failed-delete",
"previous_version_id": "1",
"workspace_info": {
"file_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/files",
"root_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default"
},
"operations": [
{
"resource_key": "jobs.stuck",
"action_type": "OPERATION_ACTION_TYPE_DELETE"
}
]
}
}
{
"method": "PATCH",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/2/operations/jobs.stuck",
"q": {
"update_mask": "error_message,resource_id,status"
},
"body": {
"error_message": "deleting id=[NUMID]: job is not deletable (400 INVALID_PARAMETER_VALUE)",
"resource_id": "[NUMID]",
"sequence_id": "0",
"status": "OPERATION_STATUS_FAILED"
}
}
{
"method": "POST",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/2/complete",
"body": {
"completion_reason": "VERSION_COMPLETE_FAILURE"
}
}

>>> print_state.py
{
"state_version": 2,
"cli_version": "[CLI_VERSION]",
"lineage": "[UUID]",
"serial": 1,
"state": {
"resources.jobs.stuck": {
"__id__": "[NUMID]",
"state": {
"deployment": {
"deployment_id": "[NUMID]",
"kind": "BUNDLE",
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/dms-failed-delete/default/state/metadata.json",
"version_id": "1"
},
"edit_mode": "UI_LOCKED",
"format": "MULTI_TASK",
"max_concurrent_runs": 1,
"name": "stuck",
"queue": {
"enabled": true
}
}
}
}
}
9 changes: 9 additions & 0 deletions acceptance/bundle/dms/failed-delete/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title "Deploy: the job is recorded"
trace $CLI bundle deploy
trace print_requests.py --dms //api/2.0/bundle

title "A resource that fails to delete is recorded as a failed operation carrying the error, so the history says why rather than showing the resource gone"
# The state entry survives too, so the next deploy still knows about the resource.
trace musterr $CLI bundle destroy --auto-approve
trace print_requests.py --dms //api/2.0/bundle
trace print_state.py
6 changes: 6 additions & 0 deletions acceptance/bundle/dms/failed-delete/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The job cannot be deleted, so the destroy fails and the operation is recorded as failed
# rather than left as if the resource were gone.
[[Server]]
Pattern = "POST /api/2.2/jobs/delete"
Response.StatusCode = 400
Response.Body = '''{"error_code": "INVALID_PARAMETER_VALUE", "message": "job is not deletable"}'''
13 changes: 8 additions & 5 deletions acceptance/bundle/dms/failed-recreate/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,24 @@ Files: 3 uploaded, 0 deleted
"update_mask": "state,error_message,resource_id,status"
},
"body": {
"error_message": "",
"resource_id": "main.dms_failed_recreate_schema",
"status": "OPERATION_STATUS_IN_PROGRESS",
"sequence_id": "0"
"sequence_id": "0",
"state": "",
"status": "OPERATION_STATUS_IN_PROGRESS"
}
}
{
"method": "PATCH",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/2/operations/schemas.foo",
"q": {
"update_mask": "error_message,status"
"update_mask": "error_message,resource_id,status"
},
"body": {
"error_message": "Fault injected by test. (400 INVALID_PARAMETER_VALUE)",
"status": "OPERATION_STATUS_FAILED",
"sequence_id": "1"
"resource_id": "",
"sequence_id": "1",
"status": "OPERATION_STATUS_FAILED"
}
}
{
Expand Down
7 changes: 4 additions & 3 deletions acceptance/bundle/dms/failed-update/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ Files: 3 uploaded, 0 deleted
"method": "PATCH",
"path": "/api/2.0/bundle/deployments/[NUMID]/versions/2/operations/schemas.foo",
"q": {
"update_mask": "error_message,status"
"update_mask": "error_message,resource_id,status"
},
"body": {
"error_message": "updating id=main.dms_failed_update_schema: Fault injected by test. (400 INVALID_PARAMETER_VALUE)",
"status": "OPERATION_STATUS_FAILED",
"sequence_id": "0"
"resource_id": "main.dms_failed_update_schema",
"sequence_id": "0",
"status": "OPERATION_STATUS_FAILED"
}
}
{
Expand Down
10 changes: 5 additions & 5 deletions acceptance/bundle/dms/multiple-resources/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Files: 4 uploaded, 0 deleted
Resources: 5 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py --dms //versions/1/operations --sort --del-body state --oneline
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.five", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.four", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.one", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.three", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.two", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"resource_id": "[NUMID]", "status": "OPERATION_STATUS_SUCCEEDED", "sequence_id": "0"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.five", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "status": "OPERATION_STATUS_SUCCEEDED"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.four", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "status": "OPERATION_STATUS_SUCCEEDED"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.one", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "status": "OPERATION_STATUS_SUCCEEDED"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.three", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "status": "OPERATION_STATUS_SUCCEEDED"}}
{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[NUMID]/versions/1/operations/jobs.two", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[NUMID]", "sequence_id": "0", "status": "OPERATION_STATUS_SUCCEEDED"}}

=== Redeploy with no changes: nothing is applied, so no operations are recorded and only the version is opened and completed
>>> [CLI] bundle deploy
Expand Down
12 changes: 12 additions & 0 deletions acceptance/bundle/dms/operation-upload-fails-once/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bundle:
name: dms-upload-fails-once

experimental:
record_deployment_history: true

resources:
schemas:
foo:
name: dms_upload_fails_once_schema
catalog_name: main
comment: v1

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

Loading