Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the entire env in __run.sh #18582

Merged
merged 3 commits into from
Mar 25, 2023
Merged

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Mar 24, 2023

Previously we set the explicit env vars passed to the Process on top of the existing env.
Now we use env -i to force the process to run with exactly the same env as it did
in the engine. This will create a much more faithful debugging setup when you poke
around in the sandbox and run __run.sh.

This happens e.g., in lint/fmt, where we don't pass env vars.
@benjyw benjyw added the category:internal CI, fixes for not-yet-released features, etc. label Mar 24, 2023
@benjyw benjyw requested a review from jsirois March 24, 2023 15:03
@benjyw
Copy link
Contributor Author

benjyw commented Mar 24, 2023

Please double-check my Rust, as I am just fumbling along there still.

@benjyw benjyw requested a review from stuhood March 24, 2023 15:04
src/rust/engine/process_execution/src/local.rs Outdated Show resolved Hide resolved
src/rust/engine/process_execution/src/local.rs Outdated Show resolved Hide resolved
src/rust/engine/process_execution/src/local.rs Outdated Show resolved Hide resolved
@benjyw benjyw changed the title Don't emit an empty export line in __run.sh. Set the entire env in __run.sh Mar 24, 2023
@benjyw benjyw requested a review from jsirois March 24, 2023 16:42
cd {stringified_cwd}
{stringified_command_line}
env -i {stringified_env_vars} {stringified_command_line}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done this by hand myself reproing user issues and it worked fine. Did you double check this still works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, ran a few different command (test, lint, fmt) with --keep-sandboxes=always, cd'd into the sandbox and ran __run.sh to ensure that the process still does the thing we expect it to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked env -i bash -c 'echo $HOME.' -> ".", but I did not gut check a sandbox __run.sh using this change.

src/rust/engine/process_execution/src/local.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants