Uh oh!
There was an error while loading. Please reload this page.
Add env section to bundle scripts for DABs interpolation - #5299
Conversation
932c672 to
0452148CompareIntegration test reportCommit: a32d68c
9 interesting tests: 4 RECOVERED, 4 SKIP, 1 flaky
Top 10 slowest tests (at least 2 minutes):
|
f373d61 to
b68897dComparescripts.<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: Isaacb68897d to
8044e34CompareResolved conflicts in NEXT_CHANGELOG.md (kept both entry sets) and bundle/internal/schema/annotations.yml (took main's regenerated layout, re-added the scripts env field annotation). Co-authored-by: Isaac
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Fix the earlier bad merge in NEXT_CHANGELOG.md: the prior merge resurrected Bundles entries that had already been swept into the v1.6.0 release. Reset the changelog to origin/main and re-added only the scripts env entry. Co-authored-by: Isaac
| PLACEHOLDER | ||
| "env": | ||
| "description": |- | ||
| PLACEHOLDER |
There was a problem hiding this comment.
please add a description here so it shows up in tooltips via the jsonschema
There was a problem hiding this comment.
Done — added a description for scripts.<name>.env in annotations.yml (regenerated jsonschema.json).
| env := scriptEnv(cmd, b) | ||
| // Append after the auth/target variables so a script's env: section takes | ||
| // precedence on collision (os/exec uses the last value for a duplicate key). | ||
| for _, name := range slices.Sorted(maps.Keys(script.Env)) { | ||
| env = append(env, name+"="+script.Env[name]) | ||
| } |
There was a problem hiding this comment.
add an acceptance test for this
There was a problem hiding this comment.
Added the env-precedence acceptance test: a script's env: entry sets DATABRICKS_BUNDLE_TARGET=from-script-env and the output confirms it wins over the CLI-injected value.
| @@ -0,0 +1 @@ | |||
| errcode trace $CLI bundle validate | |||
There was a problem hiding this comment.
| errcode trace $CLI bundle validate | |
| musterr trace $CLI bundle validate |
There was a problem hiding this comment.
Applied musterr (dropped the redundant errcode).
- Add a real description for scripts.<name>.env in annotations.yml so it surfaces in jsonschema tooltips (regenerated jsonschema.json). - Use musterr instead of errcode in the env-bad-prefix script to assert the command must fail. - Add an env-precedence acceptance test proving a script's env: entry overrides a CLI-injected variable (DATABRICKS_BUNDLE_TARGET). Co-authored-by: Isaac
v1.8.0 was cut, emptying the Bundles section of NEXT_CHANGELOG.md on main. Kept only the scripts env entry. Co-authored-by: Isaac
Uh oh!
There was an error while loading. Please reload this page.
eng-dev-ecosystem-bot
commented
Jul 13, 2026
Integration test reportCommit: a152b60
33 interesting tests: 17 FAIL, 9 flaky, 4 RECOVERED, 2 SKIP, 1 KNOWN
Top 50 slowest tests (at least 2 minutes):
|
…sue databricks#4179 (databricks#5923) The fragment added by databricks#5831 linked the `env:` section changelog entry to the original issue (databricks#4179) rather than the PR that implemented the feature (databricks#5299). This includes both links.
## Release v1.8.0 ### Notable Changes * Auto-migrate a bundle from terraform to the direct engine when `bundle.engine` is `"direct"` (or `DATABRICKS_BUNDLE_ENGINE=direct`) and the post-deploy dry-run migration is clean; a warning is emitted if the dry-run surfaces errors or warnings so the automatic migration is skipped. ### CLI * experimental `ssh connect`: bare `python`/`pip` in an interactive session now resolve to the environment interpreter (`$DATABRICKS_VIRTUAL_ENV`) instead of the system or cluster-libraries interpreter, so packages installed in the environment are importable without extra setup. The interactive shell is now non-login (`bash -i`) and the server seeds a `~/.bashrc` snippet that re-prepends the environment's bin directory to `PATH` ([#5888](#5888)). * When Claude Code runs the CLI without the Databricks AI tooling installed, the CLI now prints a one-line recommendation on stderr to run `databricks aitools install`. The recommendation is shown at most once per hour per Claude session, and never for human callers or `aitools` commands. * Fixed `databricks auth describe` misattributing a profile selected via `DATABRICKS_CONFIG_PROFILE` as `(from bundle)` when run inside a bundle root ([#5904](#5904)). ### Bundles * `bundle generate` now warns when the generated configuration file is not matched by any pattern in the `include` section of `databricks.yml` ([#5868](#5868)). * direct: Match UC Auto Upgrade managed property defaults with a wildcard pattern instead of enumerating each key ([#5877](#5877)). * Recognize `ssh://` template URLs in `databricks bundle init` ([#5891](#5891)). * `databricks bundle init` now reports an actionable error when given a template URL with an unsupported protocol (`http://`, `git://`, `ftp://`, `ftps://`) instead of failing with a confusing "not a bundle template" message ([#5902](#5902)). * Added an `env:` section to `scripts.<name>` for declaring environment variables that may reference `${bundle.*}`, `${workspace.*}`, and `${var.*}` ([#4179](#4179), [#5299](#5299)).
Fixes#4179.
Adds an
env:map toscripts.<name>. Values may reference${bundle.*},${workspace.*}, and${var.*}; they're resolved before the script runs and exported into its shell, wherecontentuses plain$NAME:contentis still passed to the shell as-is, so${...}incontentstays unsupported (the error now points to theenv:section). Env values with any other prefix (e.g.${resources.*}) are rejected. On a name collision with the CLI-injected auth vars, the script'senv:wins.This pull request was AI-assisted by Isaac.