Change controller_util and goma_util to handle custom goma approach.

Change the controller_util to allow parsing and forwarding of custom
GomaApproach. Change goma_util to handle new goma approach setting
custom environment variables accordingly. This is added to facilitate
the testing of new goma approaches per moving to the GCP+RBE backend.
See attached bug for more context.

TEST=./run_tests
BUG=chromium:981711

Change-Id: I74bd357fcbda155ba529b3308c6a91045f992e61
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1869327
Reviewed-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Tested-by: David Burger <dburger@chromium.org>
Commit-Queue: David Burger <dburger@chromium.org>
diff --git a/api/controller/controller_util.py b/api/controller/controller_util.py
index af76a6b..aa18bb7 100644
--- a/api/controller/controller_util.py
+++ b/api/controller/controller_util.py
@@ -59,11 +59,18 @@
   goma = None
   if chroot_message.goma.goma_dir:
     chromeos_goma_dir = chroot_message.goma.chromeos_goma_dir or None
+    goma_approach = None
+    if chroot_message.goma.goma_approach == common_pb2.GomaConfig.RBE_PROD:
+      goma_approach = goma_util.GomaApproach('?prod', 'goma.chromium.org', True)
+    elif chroot_message.goma.goma_approach == common_pb2.GomaConfig.RBE_STAGING:
+      goma_approach = goma_util.GomaApproach('?staging',
+                                             'staging-goma.chromium.org', True)
     goma = goma_util.Goma(chroot_message.goma.goma_dir,
                           chroot_message.goma.goma_client_json,
                           stage_name='BuildAPI',
                           chromeos_goma_dir=chromeos_goma_dir,
-                          chroot_dir=path)
+                          chroot_dir=path,
+                          goma_approach=goma_approach)
 
   return Chroot(path=path, cache_dir=cache_dir, chrome_root=chrome_root,
                 env=env, goma=goma)