Skip to content

Commit a76dc13

Browse files
denikpietern
andauthored
direct: Resolve ${resources.group.key.id} and order deployment accordingly (#3390)
## Changes The "${resources.<group>.<key>.id}" references are now substituted by direct deployment backend. They are used to build DAG both during planning and apply. ## Tests New test that check jobs update, pipeline recreation and reference going into integer field. All existing tests that were disabled due to lack of `${resources}` support are enabled. --------- Co-authored-by: Pieter Noordhuis <[email protected]>
1 parent d4d6736 commit a76dc13

File tree

50 files changed

+1256
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1256
-106
lines changed

acceptance/bundle/deploy/jobs/double-underscore-keys/out.test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Local = true
22
Cloud = true
33

44
[EnvMatrix]
5-
DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Local = true
22
Cloud = true
33

4-
EnvMatrix.DATABRICKS_CLI_DEPLOYMENT = ["terraform"] # (only on Cloud/direct) Error: deploying jobs.foo: Method=Jobs.Create *retries.Err *apierr.APIError StatusCode=400 ErrorCode="INVALID_PARAMETER_VALUE" Message="Missing required field: settings.tasks.task_key."
5-
64
Ignore = [
75
"databricks.yml",
86
]

acceptance/bundle/deploy/pipeline/recreate/out.test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Cloud = true
33
RequiresUnityCatalog = true
44

55
[EnvMatrix]
6-
DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
6+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]

acceptance/bundle/deploy/pipeline/recreate/script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title "Assert the pipeline is created"
1111
PIPELINE_ID=$($CLI bundle summary -o json | jq -r '.resources.pipelines.foo.id')
1212
trace $CLI pipelines get "${PIPELINE_ID}" | jq "{spec}"
1313

14-
trace $CLI bundle plan --var="catalog=another_catalog"
14+
trace $CLI bundle plan --var="catalog=another_catalog" 2>&1 | sort
1515

1616
title "Try to redeploy the bundle, pointing the DLT pipeline to a different UC catalog"
1717
trace errcode $CLI bundle deploy --force-lock --var="catalog=another_catalog"

acceptance/bundle/deploy/pipeline/recreate/test.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Local = true
22
Cloud = true
33
RequiresUnityCatalog = true
44

5-
EnvMatrix.DATABRICKS_CLI_DEPLOYMENT = ["terraform"] # ${resources} support
6-
75
Ignore = [
86
"databricks.yml"
97
]

acceptance/bundle/deploy/schema/auto-approve/out.test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Cloud = true
33
RequiresUnityCatalog = true
44

55
[EnvMatrix]
6-
DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
6+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]

acceptance/bundle/deploy/schema/auto-approve/test.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ Local = true
22
Cloud = true
33
RequiresUnityCatalog = true
44

5-
EnvMatrix.DATABRICKS_CLI_DEPLOYMENT = ["terraform"] # requires "${resources}"
6-
75
Ignore = [
86
"databricks.yml",
97
"test-file-*.txt",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resources:
2+
jobs:
3+
bar:
4+
name: job bar
5+
foo:
6+
name: job foo
7+
tasks:
8+
- task_key: job_task
9+
run_job_task:
10+
job_id: ${resources.jobs.bar.id}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
>>> [CLI] bundle plan
3+
create jobs.bar
4+
create jobs.foo
5+
6+
>>> [CLI] bundle deploy
7+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
8+
Deploying resources...
9+
Updating deployment state...
10+
Deployment complete!
11+
12+
>>> print_requests
13+
{
14+
"body": {
15+
"deployment": {
16+
"kind": "BUNDLE",
17+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json"
18+
},
19+
"edit_mode": "UI_LOCKED",
20+
"format": "MULTI_TASK",
21+
"max_concurrent_runs": 1,
22+
"name": "job bar",
23+
"queue": {
24+
"enabled": true
25+
}
26+
},
27+
"method": "POST",
28+
"path": "/api/2.2/jobs/create"
29+
}
30+
{
31+
"body": {
32+
"deployment": {
33+
"kind": "BUNDLE",
34+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/state/metadata.json"
35+
},
36+
"edit_mode": "UI_LOCKED",
37+
"format": "MULTI_TASK",
38+
"max_concurrent_runs": 1,
39+
"name": "job foo",
40+
"queue": {
41+
"enabled": true
42+
},
43+
"tasks": [
44+
{
45+
"run_job_task": {
46+
"job_id": [BAR_ID]
47+
},
48+
"task_key": "job_task"
49+
}
50+
]
51+
},
52+
"method": "POST",
53+
"path": "/api/2.2/jobs/create"
54+
}
55+
56+
>>> [CLI] bundle destroy --auto-approve
57+
The following resources will be deleted:
58+
delete job bar
59+
delete job foo
60+
61+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
62+
63+
Deleting files...
64+
Destroy complete!
65+
66+
>>> print_sorted_requests
67+
{
68+
"body": {
69+
"job_id": [BAR_ID]
70+
},
71+
"method": "POST",
72+
"path": "/api/2.2/jobs/delete"
73+
}
74+
{
75+
"body": {
76+
"job_id": [FOO_ID]
77+
},
78+
"method": "POST",
79+
"path": "/api/2.2/jobs/delete"
80+
}

0 commit comments

Comments
 (0)