-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy pathscript
More file actions
28 lines (21 loc) · 2.21 KB
/
Copy pathscript
File metadata and controls
28 lines (21 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Read deployment state from DMS: build synthetic DMS state for a deployment
# whose resources, compared with databricks.yml, exercise each plan action
# - create_me: in config, not in DMS -> create
# - update_me: in both, names differ -> update
# - delete_me: in DMS, not in config -> delete
# then verify both `bundle summary` and `bundle plan` read it from DMS.
update_id=$($CLI pipelines create -o json --json '{"name":"update-me-old"}' | jq -r .pipeline_id)
delete_id=$($CLI pipelines create -o json --json '{"name":"delete-me"}' | jq -r .pipeline_id)
# DMS owns the state only once a version has completed successfully, so record one
# for the deployment before seeding its resources.
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/bundle/deployments/synthetic-dep/versions?version_id=1" --json '{"version_type":"VERSION_TYPE_DEPLOY"}' > /dev/null
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/bundle/deployments/synthetic-dep/versions/1/complete" --json '{"completion_reason":"VERSION_COMPLETE_SUCCESS"}' > /dev/null
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/bundle/deployments/synthetic-dep/versions/1/operations" --json "{\"resource_key\":\"pipelines.update_me\",\"resource_id\":\"$update_id\",\"action_type\":\"OPERATION_ACTION_TYPE_CREATE\",\"status\":\"OPERATION_STATUS_SUCCEEDED\",\"state\":{\"name\":\"update-me-old\"}}" > /dev/null
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/bundle/deployments/synthetic-dep/versions/1/operations" --json "{\"resource_key\":\"pipelines.delete_me\",\"resource_id\":\"$delete_id\",\"action_type\":\"OPERATION_ACTION_TYPE_CREATE\",\"status\":\"OPERATION_STATUS_SUCCEEDED\",\"state\":{\"name\":\"delete-me\"}}" > /dev/null
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.0/workspace-files/import-file/Workspace/Users/$CURRENT_USER_NAME/.bundle/dms-read/default/state/resources.json?overwrite=true" --json '{"state_version":2,"lineage":"synthetic-dep","serial":1,"state":{}}' > /dev/null
title "bundle summary reflects resources read from DMS (update_me resolves its id; create_me is not deployed)"
trace $CLI bundle summary
title "bundle plan derives actions from DMS state: create create_me, update update_me, delete delete_me"
trace $CLI bundle plan
title "full plan as JSON"
trace $CLI bundle plan -o json