Luci builder configs have now been available in separate repos. This CL enables validation of the config json file format for cocoon recipe.

Change-Id: I7d7392f190535d3002039e50c106fca4da07ea10
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/5320
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
diff --git a/recipes/cocoon.expected/pull_request.json b/recipes/cocoon.expected/pull_request.json
index 60da55f..67c2406 100644
--- a/recipes/cocoon.expected/pull_request.json
+++ b/recipes/cocoon.expected/pull_request.json
@@ -89,6 +89,24 @@
   },
   {
     "cmd": [
+      "vpython",
+      "-u",
+      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+      "--json-output",
+      "/path/to/tmp/json",
+      "copy",
+      "[START_DIR]/cocoon/dev/try_builders.json",
+      "/path/to/tmp/"
+    ],
+    "infra_step": true,
+    "name": "validate try json format",
+    "~followup_annotations": [
+      "@@@STEP_LOG_LINE@try_builders.json@\"\"@@@",
+      "@@@STEP_LOG_END@try_builders.json@@@"
+    ]
+  },
+  {
+    "cmd": [
       "python",
       "-u",
       "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py",
diff --git a/recipes/cocoon.py b/recipes/cocoon.py
index 31fda49..b90504d 100644
--- a/recipes/cocoon.py
+++ b/recipes/cocoon.py
@@ -5,6 +5,7 @@
 
 DEPS = [
     'depot_tools/git',
+    'flutter/json_util',
     'flutter/repo_util',
     'flutter/yaml',
     'recipe_engine/buildbucket',
@@ -29,6 +30,9 @@
       url=api.properties.get('git_url'),
       ref=api.properties.get('git_ref'))
 
+  # Validates engine builders json format.
+  api.json_util.validate_json(cocoon_path, 'cocoon')
+
   # Checkout flutter/flutter at head.
   flutter_git_ref = 'refs/heads/stable'
   api.repo_util.checkout('flutter', flutter_path, ref=flutter_git_ref)