Skip to content

Commit 2e70558

Browse files
authored
Resolve variables in a loop (#2164)
## Changes - Instead of doing 2 passes on variable resolution, do a loop until there are no more updates (or we reach count 100). - Stacked on top of #2163 which is a regression test for this: acceptance/bundle/variables/complex-transitive-deep ## Tests Existing tests, new regression tests. These tests already passed before, added for completeness: - acceptance/bundle/variables/cycle - acceptance/bundle/variables/complex-cross-ref
1 parent f2bba63 commit 2e70558

File tree

15 files changed

+156
-12
lines changed

15 files changed

+156
-12
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bundle:
2+
name: complex-cross-ref
3+
4+
variables:
5+
a:
6+
default:
7+
a_1: 500
8+
a_2: ${var.b.b_2}
9+
b:
10+
default:
11+
b_1: ${var.a.a_1}
12+
b_2: 2.5
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"a": {
3+
"default": {
4+
"a_1": 500,
5+
"a_2": 2.5
6+
},
7+
"value": {
8+
"a_1": 500,
9+
"a_2": 2.5
10+
}
11+
},
12+
"b": {
13+
"default": {
14+
"b_1": 500,
15+
"b_2": 2.5
16+
},
17+
"value": {
18+
"b_1": 500,
19+
"b_2": 2.5
20+
}
21+
}
22+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$CLI bundle validate -o json | jq .variables
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bundle:
2+
name: cycle
3+
4+
variables:
5+
a:
6+
default:
7+
hello: ${var.a}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Warning: Detected unresolved variables after 11 resolution rounds
2+
3+
Name: cycle
4+
Target: default
5+
Workspace:
6+
User: $USERNAME
7+
Path: /Workspace/Users/$USERNAME/.bundle/cycle/default
8+
9+
Found 1 warning
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$CLI bundle validate
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bundle:
2+
name: cycle
3+
4+
variables:
5+
a:
6+
default:
7+
hello: ${var.b}
8+
b:
9+
default:
10+
hello: ${var.a}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Warning: Detected unresolved variables after 11 resolution rounds
2+
3+
Name: cycle
4+
Target: default
5+
Workspace:
6+
User: $USERNAME
7+
Path: /Workspace/Users/$USERNAME/.bundle/cycle/default
8+
9+
Found 1 warning
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$CLI bundle validate
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"spark.databricks.sql.initial.catalog.name": "${var.catalog}"
2+
"spark.databricks.sql.initial.catalog.name": "hive_metastore"
33
}

0 commit comments

Comments
 (0)