pw_presubmit: Use environment options

Bug: 600
Change-Id: I22de8171660f71e4661ecab72740e93558c3374b
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/79909
Reviewed-by: Oliver Newman <olivernewman@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/recipes/pw_presubmit.proto b/recipes/pw_presubmit.proto
index 15b16b8..54c03c2 100644
--- a/recipes/pw_presubmit.proto
+++ b/recipes/pw_presubmit.proto
@@ -14,6 +14,8 @@
 
 syntax = "proto3";
 
+import "recipe_modules/pigweed/environment/options.proto";
+
 // This message is used for both the pw_presubmit and pw_presubmit_container
 // recipes.
 package recipes.pigweed.pw_presubmit;
@@ -24,4 +26,7 @@
 
   // File extensions to sign. (E.g., ".out", ".sign-me", ...)
   repeated string extensions_to_sign = 2;
+
+  // Environment module options.
+  recipe_modules.pigweed.environment.Options environment_options = 3;
 }
diff --git a/recipes/pw_presubmit.py b/recipes/pw_presubmit.py
index 4fe254e..edc940c 100644
--- a/recipes/pw_presubmit.py
+++ b/recipes/pw_presubmit.py
@@ -71,9 +71,9 @@
     api.checkout()
     root = api.checkout.root
 
-    api.environment.init(root)
+    env = api.environment.init(root, props.environment_options)
 
-    with api.environment():
+    with env():
         api.pw_presubmit.init(root)
 
         with api.step.defer_results():
@@ -112,7 +112,7 @@
         uploaded_public_key = False
 
         with api.step.nest('upload') as pres:
-            with api.environment():
+            with env():
                 command = api.pw_presubmit.command_name.split()
                 command.extend(['--directory', root, 'build-id'])
                 step_data = api.step(