Add env section to bundle scripts for DABs interpolation#5299
Add env section to bundle scripts for DABs interpolation#5299shreyas-goenka wants to merge 4 commits into
Conversation
932c672 to
0452148
Compare
Integration test reportCommit: 46a34af
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 15 slowest tests (at least 2 minutes):
|
f373d61 to
b68897d
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
b68897d to
8044e34
Compare
Approval status: pending
|
Resolved 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
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
| 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
| @@ -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 |
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.