Skip to content

Add env section to bundle scripts for DABs interpolation#5299

Draft
shreyas-goenka wants to merge 1 commit into
mainfrom
script-env-section
Draft

Add env section to bundle scripts for DABs interpolation#5299
shreyas-goenka wants to merge 1 commit into
mainfrom
script-env-section

Conversation

@shreyas-goenka
Copy link
Copy Markdown
Contributor

Summary

Fixes #4179.

scripts.<name> now accepts an env: map whose values may reference ${bundle.*}, ${workspace.*}, and ${var.*}. Script content is still passed to the shell as-is (no DABs interpolation), removing the ambiguity between bundle variables and shell variables that previously forced all ${...} usage to be rejected.

scripts:
  create_lakebase_schemas:
    env:
      LAKEBASE_INSTANCE: \${var.lakebase_instance}
      LAKEBASE_DATABASE: \${var.lakebase_database}
    content: databricks psql \$LAKEBASE_INSTANCE -- -d \$LAKEBASE_DATABASE -c 'CREATE SCHEMA my_schema;'
  • If an env value references a prefix that isn't resolved before scripts run (e.g. \${resources.*}), validation reports a clear error pointing at the offending env entry.
  • The content-side rejection message now suggests using env: instead of just stating \${...} is unsupported.

The allowed prefixes (bundle, workspace, var/variables) match defaultPrefixes used by `ResolveVariableReferencesWithoutResources`, so values are already resolved by the time `bundle run` invokes the script.

Test plan

  • `go test ./bundle/...`
  • `go test ./acceptance -run 'TestAccept/bundle/run/scripts'` — happy path (`env-section`), invalid prefix (`env-bad-prefix`), updated rejection message (`no-interpolation`)
  • `./task lint-q`

This pull request was AI-assisted by Isaac.

scripts.<name> now accepts an env: map whose values may reference
${bundle.*}, ${workspace.*}, and ${var.*}. The script content is still
passed to the shell as-is (no DABs interpolation), removing the ambiguity
between bundle variables and shell variables that previously forced all
${...} usage to be rejected.

When an env value references an unsupported prefix (e.g. ${resources.*}),
validation reports a clear error pointing at the field. The content-side
error now suggests the new env section instead of just stating ${...} is
unsupported.

Fixes #4179

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature suggestion - variable interpolation in DAB script

1 participant