[beta] Add support for the beta channel to the recipes

https://github.com/dart-lang/sdk/issues/40987

Change-Id: Ibdf83a0bdf21d5c3d31e76a5350151963bc42e3e
Reviewed-on: https://dart-review.googlesource.com/c/recipes/+/138822
Reviewed-by: Karl Klose <karlklose@google.com>
diff --git a/README.recipes.md b/README.recipes.md
index e403574..b292568 100644
--- a/README.recipes.md
+++ b/README.recipes.md
@@ -37,7 +37,7 @@
 
 Checks out the dart code and prepares it for building.
 
-&mdash; **def [collect\_all](/recipe_modules/dart/api.py#281)(self, steps):**
+&mdash; **def [collect\_all](/recipe_modules/dart/api.py#282)(self, steps):**
 
 Collects the results of a sharded test run.
 
@@ -49,11 +49,11 @@
 
 Returns the path to the checked-in SDK dart executable.
 
-&mdash; **def [delete\_debug\_log](/recipe_modules/dart/api.py#563)(self):**
+&mdash; **def [delete\_debug\_log](/recipe_modules/dart/api.py#564)(self):**
 
 Deletes the debug log file
 
-&mdash; **def [download\_browser](/recipe_modules/dart/api.py#834)(self, runtime, version):**
+&mdash; **def [download\_browser](/recipe_modules/dart/api.py#835)(self, runtime, version):**
 
 &mdash; **def [download\_parent\_isolate](/recipe_modules/dart/api.py#155)(self):**
 
@@ -65,7 +65,7 @@
 
 Kills leftover tasks from previous runs or steps.
 
-&mdash; **def [read\_debug\_log](/recipe_modules/dart/api.py#551)(self):**
+&mdash; **def [read\_debug\_log](/recipe_modules/dart/api.py#552)(self):**
 
 Reads the debug log file
 
@@ -74,7 +74,7 @@
 Runs test.py in the given isolate, sharded over several swarming tasks.
 Returns the created tasks, which can be collected with collect_all().
 
-&mdash; **def [test](/recipe_modules/dart/api.py#569)(self, test_data):**
+&mdash; **def [test](/recipe_modules/dart/api.py#570)(self, test_data):**
 
 Reads the test-matrix.json file in checkout and runs each step listed
 in the file.
diff --git a/recipe_modules/dart/api.py b/recipe_modules/dart/api.py
index 6fb6585..f81915e 100644
--- a/recipe_modules/dart/api.py
+++ b/recipe_modules/dart/api.py
@@ -267,9 +267,10 @@
 
   def _release_builder(self):
     """Boolean that reports whether the builder is on the
-       dev or stable channel. Some steps are only run on the
-       master and try builders."""
-    return (self.m.buildbucket.builder_name.endswith('-dev') or
+       beta, dev or stable channels. Some steps are only
+       run on the master and try builders."""
+    return (self.m.buildbucket.builder_name.endswith('-beta') or
+            self.m.buildbucket.builder_name.endswith('-dev') or
             self.m.buildbucket.builder_name.endswith('-stable'))
 
   def _try_builder(self):
@@ -409,7 +410,7 @@
     self._upload_result(builder, build_number, 'logs.json', logs_str)
     self._upload_result(builder, build_number, 'results.json', results_str)
     self._upload_result(builder, build_number, 'flaky.json', flaky_json_str)
-    if not (builder.endswith('dev') or builder.endswith('stable')):
+    if not self._release_builder():
       self._upload_result('current_flakiness', 'single_directory',
                           'flaky_current_%s.json' % builder, flaky_json_str)
     # Update "latest" file
@@ -579,7 +580,7 @@
           step_test_data=lambda: self.m.json.test_api.output(test_data))
       test_matrix = read_json.json.output
       builder = str(self.m.buildbucket.builder_name)
-      if builder.endswith(('-be', '-try', '-stable', '-dev')):
+      if builder.endswith(('-be', '-beta', '-dev', '-stable', '-try')):
         builder = builder[0:builder.rfind('-')]
       isolate_hashes = {}
       global_config = test_matrix['global']
@@ -1100,9 +1101,10 @@
       self.environment_variables = step_json.get('environment', {})
 
       channels = {
-        "refs/heads/master": "be",
-        "refs/heads/stable": "stable",
-        "refs/heads/dev": "dev"
+          "refs/heads/master": "be",
+          "refs/heads/beta": "beta",
+          "refs/heads/dev": "dev",
+          "refs/heads/stable": "stable",
       }
       channel = channels.get(self.m.buildbucket.gitiles_commit.ref, 'try')
       self.environment_variables['BUILDBOT_BUILDERNAME'] = (