如何在自定义Bazel规则中禁用沙箱?
我希望SandBox 始终为此规则的每个实例化禁用,而无需用户必须做任何事情。
在规则实现中创建操作时,包括包含no-sandbox
键的execution_requirements
dict参数,值为1
。这迫使行动永远不会在沙箱中运行。
def _impl(ctx):
ctx.actions.run_shell(
outputs = [ctx.outputs.executable],
command = "..",
execution_requirements = {
"no-sandbox": "1",
"no-cache": "1",
"no-remote": "1",
"local": "1",
},
)
有关这些标签/要求的更多信息,请参见文档上的tags
属性。