aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-06-04 18:44:40 -0400
committerGravatar John Cater <jcater@google.com>2017-06-05 10:19:14 -0400
commitff1a3c05c9fca488056751c31bcd32c467850867 (patch)
tree94ef0c34d760aa8a4fd8672af85399191c09bf16 /src
parent461adba25f24d77c7b8edb898145902b51c5ef67 (diff)
Add a new flag --sandbox_writable_path, which asks the sandbox to make an
existing directory writable when running actions. RELNOTES: Added a new flag --sandbox_writable_path, which asks the sandbox to make an existing directory writable when running actions. PiperOrigin-RevId: 157971858
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java6
2 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java
index 437d1ae4a1..3c074aaf70 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxOptions.java
@@ -133,6 +133,16 @@ public class SandboxOptions extends OptionsBase {
public List<String> sandboxTmpfsPath;
@Option(
+ name = "sandbox_writable_path",
+ allowMultiple = true,
+ defaultValue = "",
+ category = "config",
+ help = "For sandboxed actions, make an existing directory writable in the sandbox"
+ + " (if supported by the sandboxing implementation, ignored otherwise)."
+ )
+ public List<String> sandboxWritablePath;
+
+ @Option(
name = "sandbox_add_mount_pair",
allowMultiple = true,
converter = MountPairConverter.class,
diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java
index c0ab7fd0fd..b80066bb56 100644
--- a/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/sandbox/SandboxStrategy.java
@@ -201,6 +201,12 @@ abstract class SandboxStrategy implements SandboxedSpawnActionContext {
// needed directory if it doesn't exist yet.
writablePaths.add(sandboxExecRoot.getRelative(env.get("TEST_TMPDIR")));
}
+
+ FileSystem fileSystem = sandboxExecRoot.getFileSystem();
+ for (String writablePath : sandboxOptions.sandboxWritablePath) {
+ writablePaths.add(fileSystem.getPath(writablePath));
+ }
+
return writablePaths.build();
}