-
Notifications
You must be signed in to change notification settings - Fork 184
Added support for complex variables #1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f8b286b
f8b7d64
26d1d5a
4503657
aff20cf
f5d7127
d8f50f2
f7eba5f
443b338
ddd14eb
0c4bf71
44b17cd
95c0032
59dba11
327d05e
2e3c97b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package config_tests | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestComplexVariables(t *testing.T) { | ||
|
andrewnester marked this conversation as resolved.
|
||
| t.Skip("Skipping until complex variables are implemented") | ||
| _, diags := loadTargetWithDiags("variables/complex", "default") | ||
| require.Empty(t, diags) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| bundle: | ||
| name: complex-variables | ||
|
|
||
| resources: | ||
| jobs: | ||
| my_job: | ||
| job_clusters: | ||
| - job_cluster_key: key | ||
| new_cluster: ${var.cluster} | ||
|
andrewnester marked this conversation as resolved.
|
||
| tasks: | ||
| - task_key: test | ||
| job_cluster_key: key | ||
|
|
||
| variables: | ||
| cluster: | ||
| description: "A cluster definition" | ||
| default: | ||
| spark_version: "13.2.x-scala2.11" | ||
| node_type_id: "Standard_DS3_v2" | ||
| num_workers: 2 | ||
| spark_conf: | ||
| spark.speculation: true | ||
| spark.databricks.delta.retentionDurationCheck.enabled: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,8 +99,18 @@ func fromTypedStruct(src reflect.Value, ref dyn.Value) (dyn.Value, error) { | |
| refv = dyn.NilValue | ||
| } | ||
|
|
||
| var options []fromTypedOptions | ||
| if v.Kind() == reflect.Interface { | ||
| options = append(options, includeZeroValuedScalars) | ||
| } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to capture a variable value equal to Previously this would have been done through the non-nil pointer and dereferencing that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It otherwise fails to assign dynamic complex value containing zero valued scalars |
||
| // Convert the field taking into account the reference value (may be equal to config.NilValue). | ||
| nv, err := fromTyped(v.Interface(), refv) | ||
| vint := v.Interface() | ||
| if vint == nil { | ||
| continue | ||
| } | ||
|
andrewnester marked this conversation as resolved.
Outdated
|
||
|
|
||
| nv, err := fromTyped(vint, refv, options...) | ||
| if err != nil { | ||
| return dyn.InvalidValue, err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.