Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


### Bundles
* Bundle variable references now accept Unicode letters in path segments (e.g. `${var.变量}`). ([#5532](https://github.com/databricks/cli/pull/5532))
* Set the default `data_security_mode` to `DATA_SECURITY_MODE_AUTO` in bundle templates ([#5452](https://github.com/databricks/cli/pull/5452)).
* Mark vector search index index_subtype as backend_default to prevent drift after deployment ([#5454](https://github.com/databricks/cli/pull/5454)).
* `bundle deployment migrate`: handle resources added to or removed from `databricks.yml` since the last Terraform deploy ([#5463](https://github.com/databricks/cli/pull/5463)).
Expand Down
11 changes: 11 additions & 0 deletions acceptance/bundle/variables/unicode_reference/databricks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: unicode-vars

variables:
变量:
default: hello

resources:
jobs:
foo:
name: ${var.变量}
3 changes: 3 additions & 0 deletions acceptance/bundle/variables/unicode_reference/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions acceptance/bundle/variables/unicode_reference/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

>>> [CLI] bundle validate -o json
"hello"
1 change: 1 addition & 0 deletions acceptance/bundle/variables/unicode_reference/script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trace $CLI bundle validate -o json | jq .resources.jobs.foo.name
6 changes: 5 additions & 1 deletion bundle/internal/schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import (
"github.com/databricks/cli/bundle/config"
"github.com/databricks/cli/bundle/config/resources"
"github.com/databricks/cli/bundle/config/variable"
"github.com/databricks/cli/libs/dyn/dynvar"
"github.com/databricks/cli/libs/jsonschema"
"github.com/databricks/databricks-sdk-go/service/jobs"
)

// interpolationPattern builds a JSON Schema regex for ${prefix.path...} references.
// Path segments use [dynvar.BaseVarDef]; unlike the runtime matcher in ref.go, this
// requires a fixed prefix (var, resources, ...) and at least one ".segment" after it.
func interpolationPattern(s string) string {
return fmt.Sprintf(`\$\{(%s(\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\[[0-9]+\])*)+)\}`, s)
return fmt.Sprintf(`\$\{(%s(\.%s(\[[0-9]+\])*)+)\}`, s, dynvar.BaseVarDef)
}

func addInterpolationPatterns(typ reflect.Type, s jsonschema.Schema) jsonschema.Schema {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bundle:
name: invalid-unicode-ref

resources:
jobs:
foo:
max_concurrent_runs: ${var.🌍}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bundle:
name: nfd-unicode-ref

resources:
jobs:
foo:
# café in NFD (e + U+0301 combining acute); not accepted by \p{L} segment matching.
max_concurrent_runs: ${var.café}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: cjk-numeral-var

variables:
九世界:
default: 1

resources:
jobs:
foo:
max_concurrent_runs: ${var.九世界}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: unicode-vars

variables:
变量:
default: hello

resources:
jobs:
foo:
name: ${var.变量}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bundle:
name: separator-vars

variables:
world__world:
default: hello

resources:
jobs:
foo:
name: ${var.world__world}
Loading
Loading