Add env section to bundle scripts for DABs interpolation#5299
Draft
shreyas-goenka wants to merge 1 commit into
Draft
Add env section to bundle scripts for DABs interpolation#5299shreyas-goenka wants to merge 1 commit into
shreyas-goenka wants to merge 1 commit into
Conversation
932c672 to
0452148
Compare
Collaborator
Integration test reportCommit: 0452148
22 interesting tests: 15 SKIP, 7 KNOWN
Top 24 slowest tests (at least 2 minutes):
|
fa62544 to
f373d61
Compare
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
f373d61 to
b68897d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4179.
scripts.<name>now accepts anenv:map whose values may reference${bundle.*},${workspace.*}, and${var.*}. These values are resolved before the script runs and exported into the script's shell environment, wherecontentreferences them with plain$NAME:Script
contentis passed to the shell as-is. DABs interpolation (${...}) remains unsupported incontent— it would be ambiguous with a shell variable — and is rejected with an error pointing at the offendingscripts.<name>.content.Validation rejects two kinds of env entries early:
bundle/workspace/var/variables(e.g.${resources.*}), which wouldn't be resolved before the script runs.DATABRICKS_HOST,DATABRICKS_TOKEN,DATABRICKS_BUNDLE_TARGET, …).auth.ProcessEnvdeliberately strips stray auth vars to avoid conflicting auth configs, so a script must not be able to silently override the bundle's resolved workspace.The allowed prefixes match
defaultPrefixesinResolveVariableReferencesWithoutResources, so env values are resolved by the timebundle runinvokes the script.Test plan
go test ./bundle/... ./libs/auth/...go test ./acceptance -run 'TestAccept/bundle/run/scripts'— happy path (env-section), invalid env-value prefix (env-bad-prefix), reserved env name (env-reserved), and${...}rejection in content (no-interpolation)./task lint-qThis pull request was AI-assisted by Isaac.