PackagesService: Add BuildsChrome endpoint.
Endpoint to check if a particular build target has chrome in
its depgraph. A more interesting implementation will come
later. Always returning True allows the endpoint to be called
by the recipes and doesn't change its behavior.
BUG=chromium:1009610
TEST=run_tests
Change-Id: I0dfe1ba6e3fa234459ad1de72e80de6139e0b1ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1832563
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
diff --git a/api/controller/packages.py b/api/controller/packages.py
index 12c8b7e..17b8263 100644
--- a/api/controller/packages.py
+++ b/api/controller/packages.py
@@ -127,3 +127,21 @@
exists = packages.has_prebuilt(constants.CHROME_CP, build_target=build_target)
output_proto.has_prebuilt = exists
+
+
+def _BuildsChromeSuccess(_input_proto, output_proto, _config):
+ """Mock success case for BuildsChrome."""
+ output_proto.builds_chrome = True
+
+
+@faux.success(_BuildsChromeSuccess)
+@faux.empty_error
+@validate.require('build_target.name')
+@validate.validation_complete
+def BuildsChrome(input_proto, output_proto, _config):
+ """Check if the board builds chrome."""
+ _build_target = controller_util.ParseBuildTarget(input_proto.build_target)
+
+ # TODO(saklein): Call implementation once it's been completed and add tests
+ # for successful endpoint executions.
+ output_proto.builds_chrome = True