Allow banning symlink action outputs from being uploaded to a remote cache.

This is mostly a roll-forward of 4465dae23de989f1452e93d0a88ac2a289103dd9, which
was reverted by fa36d2f48965b127e8fd397348d16e991135bfb6. The main difference is
that the new behavior is now gated behind the --noremote_allow_symlink_upload
flag.

https://docs.google.com/document/d/1gnOYszitgrLVet3sQk-TKGqIcpkkDsc6aw-izoo-d64
is a design proposal to support symlinks in the remote cache, which would render
this change moot. I'd like to be able to prevent incorrect cache behavior until
that change is implemented, though.

This fixes https://github.com/bazelbuild/bazel/issues/4840 (again).

Closes #5122.

Change-Id: I2136cfe82c2e1a8a9f5856e12a37d42cabd0e299
PiperOrigin-RevId: 195261827
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
index e3b303d..3431e95 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java
@@ -214,4 +214,19 @@
             + "LogEntry.writeDelimitedTo(OutputStream)."
   )
   public String experimentalRemoteGrpcLog;
+
+  @Option(
+    name = "remote_allow_symlink_upload",
+    defaultValue = "true",
+    category = "remote",
+    documentationCategory = OptionDocumentationCategory.EXECUTION_STRATEGY,
+    effectTags = {OptionEffectTag.EXECUTION},
+    help =
+        "If true, upload action symlink outputs to the remote cache. "
+            + "The remote cache currently doesn't support symlinks, "
+            + "so symlink outputs are converted into regular files. "
+            + "If this option is not enabled, "
+            + "otherwise cachable actions that output symlinks will fail."
+  )
+  public boolean allowSymlinkUpload;
 }