Skip to content

Commit 0487e81

Browse files
authored
Reading variables from file (#2171)
## Changes New source of default values for variables - variable file `.databricks/bundle/<target>/variable-overrides.json` CLI tries to stat and read that file every time during variable initialisation phase <!-- Summary of your changes that are easy to understand --> ## Tests Acceptance tests
1 parent 8af9efa commit 0487e81

File tree

18 files changed

+278
-19
lines changed

18 files changed

+278
-19
lines changed

acceptance/bundle/variables/empty/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Error: no value assigned to required variable a. Assignment can be done through the "--var" flag or by setting the BUNDLE_VAR_a environment variable
1+
Error: no value assigned to required variable a. Assignment can be done using "--var", by setting the BUNDLE_VAR_a environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
22

33
Name: empty${var.a}
44
Target: default

acceptance/bundle/variables/env_overrides/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"prod-a env-var-b"
1010

1111
>>> errcode $CLI bundle validate -t env-missing-a-required-variable-assignment
12-
Error: no value assigned to required variable b. Assignment can be done through the "--var" flag or by setting the BUNDLE_VAR_b environment variable
12+
Error: no value assigned to required variable b. Assignment can be done using "--var", by setting the BUNDLE_VAR_b environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
1313

1414
Name: test bundle
1515
Target: env-missing-a-required-variable-assignment
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cluster_key": {
3+
"node_type_id": "Standard_DS3_v2"
4+
}
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"cluster": {
3+
"node_type_id": "Standard_DS3_v2"
4+
},
5+
"cluster_key": "mlops_stacks-cluster",
6+
"cluster_workers": 2
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cluster": "mlops_stacks-cluster"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cluster_key": "mlops_stacks-cluster-from-file"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cluster_key": "mlops_stacks-cluster",
3+
"cluster_workers": 2
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"foo"
3+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!.databricks

0 commit comments

Comments
 (0)