Add openpay checout path env

Change-Id: Ibe47a555f9acde190e62aa1f9f1647d9bb302314
Bug: b/231462882
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/31940
Reviewed-by: Kaushik Iska <kaushikiska@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
diff --git a/recipes/devicelab/devicelab_drone.expected/basic.json b/recipes/devicelab/devicelab_drone.expected/basic.json
index 958d1bd..1bb6513 100644
--- a/recipes/devicelab/devicelab_drone.expected/basic.json
+++ b/recipes/devicelab/devicelab_drone.expected/basic.json
@@ -218,6 +218,52 @@
     ]
   },
   {
+    "cmd": [
+      "git",
+      "log",
+      "--pretty=format:%ct",
+      "-n",
+      "1"
+    ],
+    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
+    "luci_context": {
+      "realm": {
+        "name": "test:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "git commit time",
+    "timeout": 600.0
+  },
+  {
+    "cmd": [
+      "git",
+      "rev-parse",
+      "HEAD"
+    ],
+    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
+    "infra_step": true,
+    "luci_context": {
+      "realm": {
+        "name": "test:ci"
+      },
+      "resultdb": {
+        "current_invocation": {
+          "name": "invocations/build:8945511751514863184",
+          "update_token": "token"
+        },
+        "hostname": "rdbhost"
+      }
+    },
+    "name": "git rev-parse"
+  },
+  {
     "cmd": [],
     "name": "Checkout flutter/openpay"
   },
@@ -413,52 +459,6 @@
     ]
   },
   {
-    "cmd": [
-      "git",
-      "log",
-      "--pretty=format:%ct",
-      "-n",
-      "1"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "luci_context": {
-      "realm": {
-        "name": "test:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "git commit time",
-    "timeout": 600.0
-  },
-  {
-    "cmd": [
-      "git",
-      "rev-parse",
-      "HEAD"
-    ],
-    "cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk",
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "test:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "git rev-parse"
-  },
-  {
     "cmd": [],
     "name": "Initialize logs"
   },
@@ -580,6 +580,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -622,6 +623,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -664,6 +666,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -717,6 +720,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -782,6 +786,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -836,6 +841,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -898,6 +904,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -951,6 +958,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -998,6 +1006,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -1045,6 +1054,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -1092,6 +1102,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -1139,6 +1150,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -1190,6 +1202,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
@@ -1234,6 +1247,7 @@
       "LUCI_BRANCH": "",
       "LUCI_CI": "True",
       "LUCI_PR": "",
+      "OPENPAY_CHECKOUT_PATH": "[CLEANUP]/tmp_tmp_2/openpay",
       "OS": "linux",
       "PUB_CACHE": "[START_DIR]/.pub-cache",
       "REVISION": "",
diff --git a/recipes/devicelab/devicelab_drone.py b/recipes/devicelab/devicelab_drone.py
index 2d73761..b252a54 100644
--- a/recipes/devicelab/devicelab_drone.py
+++ b/recipes/devicelab/devicelab_drone.py
@@ -60,14 +60,6 @@
       api.properties.get('git_url'),
       api.properties.get('git_ref'),
   )
-  # Checkout openpay repo if property exists in builder config.
-  if api.properties.get('openpay'):
-    openpay_path = api.path.mkdtemp().join('openpay')
-    api.repo_util.checkout(
-        'openpay',
-        openpay_path,
-        ref='refs/heads/main',
-    )
 
   with api.context(cwd=flutter_path):
     commit_time = api.git(
@@ -80,6 +72,16 @@
     ).stdout.rstrip()
   env, env_prefixes = api.repo_util.flutter_environment(flutter_path)
 
+  # Checkout openpay repo if property exists in builder config.
+  if api.properties.get('openpay'):
+    openpay_path = api.path.mkdtemp().join('openpay')
+    api.repo_util.checkout(
+        'openpay',
+        openpay_path,
+        ref='refs/heads/main',
+    )
+    env['OPENPAY_CHECKOUT_PATH'] = openpay_path
+
   builder_name = api.properties.get('buildername')
   suppress_log = builder_name in SUPPRESS_LOG_BUILDER_LIST