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

Change-Id: Ie4ffbac6a80a473b67525ba49a96513669d73d9f
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/5281
Reviewed-by: Tong Wu <wutong@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
diff --git a/recipes/fuchsia_ctl.expected/demo.json b/recipes/fuchsia_ctl.expected/demo.json
index cb524e4..4cabadc 100644
--- a/recipes/fuchsia_ctl.expected/demo.json
+++ b/recipes/fuchsia_ctl.expected/demo.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]/packages/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": [
       "tool/build.sh"
     ],
     "cwd": "[START_DIR]/packages/packages/fuchsia_ctl",
diff --git a/recipes/fuchsia_ctl.py b/recipes/fuchsia_ctl.py
index 3f4f413..4694af6 100644
--- a/recipes/fuchsia_ctl.py
+++ b/recipes/fuchsia_ctl.py
@@ -17,6 +17,7 @@
     'recipe_engine/properties',
     'recipe_engine/step',
     'recipe_engine/swarming',
+    'flutter/json_util',
     'repo_util',
     'yaml',
 ]
@@ -32,6 +33,8 @@
       api.properties.get('git_url'),
       api.properties.get('git_ref'),
   )
+  # Validates packages builders json format.
+  api.json_util.validate_json(packages_dir, 'packages')
 
   # Build and uploads a new version of the fuchsia_ctl CIPD package.
   fuchsia_ctl_path = packages_dir.join('packages', 'fuchsia_ctl')