Calculate environment from bucket.

This is to remove the requirement to explicitly pass the environment
property. This also enables running led tests using all the
environments.

Bug: https://github.com/flutter/flutter/issues/112818
Change-Id: I47fca9de0841ec9b3733e913f10fe49569271716
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/35164
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
diff --git a/recipe_modules/shard_util_v2/api.py b/recipe_modules/shard_util_v2/api.py
index 4861eaf..40644ff 100644
--- a/recipe_modules/shard_util_v2/api.py
+++ b/recipe_modules/shard_util_v2/api.py
@@ -24,6 +24,14 @@
     'buildername', '$recipe_engine/runtime', 'is_experimental'
 ]
 
+# Environments map to calculate the environment from the bucket.
+ENVIRONMENTS_MAP = {
+    'try': '',
+    'staging': 'Staging ',
+    'flutter': 'Production ',
+    'prod': 'Production '
+}
+
 
 @attr.s
 class SubbuildResult(object):
@@ -160,11 +168,8 @@
 
       # Override recipe.
       drone_properties['recipe'] = recipe_name
-
-      environment = drone_properties.get('environment')
       bucket = self.m.buildbucket.build.builder.bucket
-      environment = '%s ' % environment if environment else ''
-      environment = '' if bucket == 'try' else environment
+      environment = ENVIRONMENTS_MAP[bucket]
       builder_name = build.get(
           'drone_builder_name',
           '%s %sEngine Drone' % (platform_name, environment))