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

Expose starlark API for sandboxing configuration #18489

Open
gigaroby opened this issue May 24, 2023 · 5 comments
Open

Expose starlark API for sandboxing configuration #18489

gigaroby opened this issue May 24, 2023 · 5 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request

Comments

@gigaroby
Copy link

In rules_rust we have a feature (pipelining) that requires filesystem sandboxing in order to work correctly but (as far as I can tell) there's no API to tell if sandboxing is enabled. We have resorted to workarounds like disabling windows (where sandboxing is not available) but this still causes confusing errors. Could we please expose such an API to rule authors?

@sgowroji sgowroji added type: feature request untriaged team-Local-Exec Issues and PRs for the Execution (Local) team labels May 25, 2023
@tjgq tjgq added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels May 30, 2023
@larsrc-google
Copy link
Contributor

Before changing the API, I'd like to hear more precisely what you need to do based on this information. Would it for instance be enough to be able to tag rules with "requires-sandbox" or somesuch?

@gigaroby
Copy link
Author

Ideally I'd like to replace part 2 here with a call to something like is_filesystem_sandboxed(). I don't really need much else.

@larsrc-google
Copy link
Contributor

So this determines whether you output an extra file with metadata? That's not something that can be determined that early. Only once the action graph has been built and execution has started will the process of figuring out what strategy to use (remote, sandboxed, worker, docker, ...) get initiated. So that's already a problem. Then there's the question of how to restrict whatever action actually creates that file to only run in a sandbox. We try hard to make it transparent to the rule how it actually gets run, as we want to get the same results regardless of strategy. What is it that makes this part require sandboxing when the rest doesn't? That's unusual.

@gigaroby
Copy link
Author

gigaroby commented Jun 6, 2023

The reason why I need to know is that we run two (very similar) instances of the same compiler. Those are similar enough that they emit the same file twice (but we only care about it from one of the rules). Without filesystem sandboxing, one compiler tries to overwrite the output of the other (and fails). Right now if we try to run with the feature enabled but without sandbox we get a very confusing (for the user) message about file permissions.

@larsrc-google
Copy link
Contributor

That's not a good state to be in. Bazel assumes that a given output is only declared by one rule, the ActionConflictChecker checks for that. Are you only declaring it as an output from one of the rules, but the compiler for the other one happens to also write it? If so, you ought to be able to check what outputs you declare and adjust creating metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants