Skip to content

Conversation

@AryanBagade
Copy link

Changes

Add a parser to properly distinguish valid DAB variable interpolation from bash environment variables in scripts.

  • Added FindAllInterpolationReferences() and HasValidDABPrefix() helper functions in libs/dyn/dynvar/ref.go
  • Updated bundle/config/validate/scripts.go to allow valid DAB references (${var.x}, ${bundle.name}, etc.) while rejecting ambiguous patterns like ${FOO}
  • Improved error messages with helpful suggestions (e.g., "use $FOO for env var or ${var.FOO} for bundle variable"

Why

Previously, all ${...} patterns were blocked in scripts with a generic error message. This made it impossible to use DAB variable interpolation in scripts, forcing users to rely on environment variables as a workaround.
With this change:

  • ${var.foo}, ${bundle.name}, ${workspace.host}, etc. are now allowed and resolved
  • $HOME and ${VAR:-default} (bash syntax) continue to work
  • ${FOO} (ambiguous) shows a helpful error with suggestions

Fixes #4179

Tests

  • Added unit tests in bundle/config/validate/scripts_test.go
  • Added unit tests in libs/dyn/dynvar/ref_test.go
  • Added acceptance test acceptance/bundle/run/scripts/valid-interpolation/
  • Updated existing acceptance test acceptance/bundle/run/scripts/no-interpolation/
  • All tests pass: go test ./libs/dyn/dynvar/... ./bundle/config/validate/...
  • Lint passes: make lint (0 issues)

…variables in scripts (databricks#4179)

Signed-off-by: Aryan Bagade <aryan@aryanbagade.com>
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4197
  • Commit SHA: 6f7bcd149ff6a831d4244ce9bc9f9128a48d731e

Checks will be approved automatically on success.

@AryanBagade
Copy link
Author

@shreyas-goenka could you please review this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature suggestion - variable interpolation in DAB script

2 participants