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

support {chroot} for program arguments in remote execution #21803

Merged
merged 7 commits into from
Dec 31, 2024

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Dec 30, 2024

As reported in #17519, remote environments do not currently support the {chroot} replacement marker supported by the local and Docker environments. With local and Docker environments, Pants will replace any {chroot} marker with the absolute path of the sandbox directory if it appears in a program argument or environment variable.

This PR is a partial solution and implements {chroot} replacement for prorgram arguments used in remote execution. It by extends the existing wrapper script used for append-only caches to also support {chroot} replacements.

This PR does not try to implement {chroot} replacement for environment variables. That will need to come after I figure out a good way to do that.

@tdyas tdyas added the category:internal CI, fixes for not-yet-released features, etc. label Dec 30, 2024
@tdyas tdyas requested review from benjyw and huonw December 30, 2024 21:14
@tdyas tdyas marked this pull request as draft December 30, 2024 21:39
@tdyas tdyas marked this pull request as ready for review December 30, 2024 22:24
Comment on lines +1112 to +1113
Some(_) => "/bin/bash", // the array features need bash and not just plain old /bin/sh
_ => "/bin/sh",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These paths (and others) ideally would be discovered in the remote execution environment, but the REAPI client is what runs those programs in the remote execution environment in the first place. Maybe we should make these configurable in the future?

Copy link
Contributor Author

@tdyas tdyas Dec 30, 2024

Choose a reason for hiding this comment

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

Or an alternate solution like download BusyBox and use its ash shell (possibly only if array variables are supported).

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, interesting approach. Definitely seems expedient.

Copy link
Contributor

@huonw huonw left a comment

Choose a reason for hiding this comment

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

Looks good, comments are minor; only the release notes one needs adjustment before merging, the other is optional.

docs/notes/2.25.x.md Outdated Show resolved Hide resolved
Comment on lines +1112 to +1113
Some(_) => "/bin/bash", // the array features need bash and not just plain old /bin/sh
_ => "/bin/sh",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, interesting approach. Definitely seems expedient.

src/rust/engine/process_execution/src/lib.rs Outdated Show resolved Hide resolved
@tdyas tdyas merged commit 11588d6 into pantsbuild:main Dec 31, 2024
24 checks passed
@tdyas tdyas deleted the rexec/support_chroot_in_wrapper branch December 31, 2024 21:47
tdyas added a commit that referenced this pull request Jan 3, 2025
…ution (#21810)

As described in #17519, remote execution environments did not substitute
the `{chroot}` marker with the path to the execution sandbox as is done
with local and Docker environments. #21803 added this support for
program arguments. This PR completes the feature and implements that
support for environment variables.

Closes #17519.
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