SetBinhost: Use new file for new post-submit builders

There is a fight between the legacy and new post-submit builders
when using the same files. Instead, have the new builders write
out to new files.

BUG=chromium:964242
TEST=run_tests

Change-Id: Iaca108cc5e24490885f4e52652b9c63b9ddf09b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1621251
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Evan Hernandez <evanhernandez@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
diff --git a/api/controller/binhost.py b/api/controller/binhost.py
index 2ba5ad0..ff6ca6f 100644
--- a/api/controller/binhost.py
+++ b/api/controller/binhost.py
@@ -64,6 +64,17 @@
   key = binhost_pb2.BinhostKey.Name(input_proto.key)
   uri = input_proto.uri
   private = input_proto.private
+
+  # Temporary measure to force the new parallel cq post submit builders to write
+  # to a different file than the old ones. Writing to the same file was causing
+  # them to fight over the new one's value and the old logic of clearing out
+  # the values for files it didn't update. Once we've done a full switch over,
+  # we can dump this logic and delete all of the PARALLEL_POSTSUBMIT_BINHOST
+  # configs.
+  # TODO(crbug.com/965244) remove this.
+  if key == 'POSTSUBMIT_BINHOST':
+    key = 'PARALLEL_POSTSUBMIT_BINHOST'
+
   output_proto.output_file = binhost.SetBinhost(target, key, uri,
                                                 private=private)
 
diff --git a/api/controller/binhost_unittest.py b/api/controller/binhost_unittest.py
index 0738e1b..1ae869d 100644
--- a/api/controller/binhost_unittest.py
+++ b/api/controller/binhost_unittest.py
@@ -66,8 +66,8 @@
 
     self.assertEqual(output_proto.output_file, '/path/to/BINHOST.conf')
     set_binhost.assert_called_once_with(
-        'target', 'POSTSUBMIT_BINHOST', 'gs://chromeos-prebuilt/target',
-        private=True)
+        'target', 'PARALLEL_POSTSUBMIT_BINHOST',
+        'gs://chromeos-prebuilt/target', private=True)
 
 class RegenBuildCacheTest(cros_test_lib.MockTestCase):
   """Unittests for RegenBuildCache."""