Skip to content

fix: propagate env vars with shell: cap.sh {0}#146

Closed
iamazeem wants to merge 4 commits into
cross-platform-actions:masterfrom
iamazeem:145-propagate-env-vars
Closed

fix: propagate env vars with shell: cap.sh {0}#146
iamazeem wants to merge 4 commits into
cross-platform-actions:masterfrom
iamazeem:145-propagate-env-vars

Conversation

@iamazeem

@iamazeem iamazeem commented May 26, 2026

Copy link
Copy Markdown

Fixes #145.

Introduced --env-vars to propagate specific env vars like this:

shell: cpa.sh {0} --env-vars "VAR_1 VAR_2 MY_VAR_* VAR_*_TEST_*"

Signed-off-by: Azeem Sajid azeem.sajid@gmail.com

iamazeem added 3 commits May 26, 2026 21:21
Signed-off-by: Azeem Sajid <azeem.sajid@gmail.com>
Signed-off-by: Azeem Sajid <azeem.sajid@gmail.com>
Signed-off-by: Azeem Sajid <azeem.sajid@gmail.com>
@iamazeem iamazeem changed the title 145 propagate env vars fix: propagate env vars with shell: cap.sh {0} May 26, 2026
@manxorist

Copy link
Copy Markdown

I do not like this approach at all.

Blindly exporting all environment variables that are set on the runner to the vm seems very wrong to me. Most of them are specific to the runner environment (hence the name, duh!) and either meaningless or outright wrong in the vm.

@jacob-carlborg

Copy link
Copy Markdown
Contributor

Yes, for the reasons mentioned by manxorist the action is not already doing this.

@iamazeem

Copy link
Copy Markdown
Author

@manxorist, @jacob-carlborg
Given the #145 (comment), this here is just an initial PoC to demonstrate that it's possible.

Definitely, exporting everything would break things e.g. PATH, TERM, etc.

How about a flag though e.g. --env-vars?

shell: cpa.sh {0} --env-vars "VAR_1 VAR_2 MY_VAR_* VAR_*_TEST_*"

Signed-off-by: Azeem Sajid <azeem.sajid@gmail.com>
@jacob-carlborg

Copy link
Copy Markdown
Contributor

A flag seems reasonable. But there's no reason to start using Python. Another dependency, starting another process, which is slower than running inside the already started Node process.

@iamazeem

iamazeem commented Jun 22, 2026

Copy link
Copy Markdown
Author

A flag seems reasonable. But there's no reason to start using Python. Another dependency, starting another process, which is slower than running inside the already started Node process.

Please feel free to update this or maybe close this in favor of an alternative implementation as you've a better understanding of all the internals and the related performance overheads.

@jacob-carlborg

Copy link
Copy Markdown
Contributor

This has been implemented in bbc9473.

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.

bug: environment variables not propagated from env context with shell: cpa.sh {0}

3 participants