api: add ArtifactsService/BuildSetup endpoint
Added as a stub to simplify transition.
Also freshen proto bindings.
BUG=chromium:1034529
TEST=cq
Cq-Depend: chromium:2677088
Change-Id: Ic993b90a5ab80100330fcbcf2ad302aebc233b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2677091
Reviewed-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Commit-Queue: LaMont Jones <lamontjones@chromium.org>
Tested-by: LaMont Jones <lamontjones@chromium.org>
diff --git a/api/controller/artifacts.py b/api/controller/artifacts.py
index 984f9ac..6ae23b4 100644
--- a/api/controller/artifacts.py
+++ b/api/controller/artifacts.py
@@ -13,6 +13,7 @@
from chromite.api import faux
from chromite.api import validate
from chromite.api.controller import controller_util
+from chromite.api.gen.chromite.api import artifacts_pb2
from chromite.api.gen.chromite.api import toolchain_pb2
from chromite.lib import chroot_lib
from chromite.lib import constants
@@ -49,6 +50,37 @@
return controller.RETURN_CODE_SUCCESS
+def _BuildSetupResponse(_input_proto, output_proto, _config):
+ """Just return POINTLESS for now."""
+ # All of the artifact types we support claim that the build is POINTLESS.
+ output_proto.build_relevance = artifacts_pb2.BuildSetupResponse.POINTLESS
+
+
+@faux.success(_BuildSetupResponse)
+@faux.empty_error
+@validate.validation_complete
+def BuildSetup(_input_proto, output_proto, _config):
+ """Setup anything needed for building artifacts
+
+ If any artifact types require steps prior to building the package, they go
+ here. For example, see ToolchainService/PrepareForBuild.
+
+ Note: crbug/1034529 introduces this method as a noop. As the individual
+ artifact_type bundlers are added here, they *must* stop uploading it via the
+ individual bundler function.
+
+ Args:
+ _input_proto (GetRequest): The input proto.
+ output_proto (GetResponse): The output proto.
+ _config (api_config.ApiConfig): The API call config.
+ """
+ # If any artifact_type says "NEEDED", the return is NEEDED.
+ # Otherwise, if any artifact_type says "UNKNOWN", the return is UNKNOWN.
+ # Otherwise, the return is POINTLESS.
+ output_proto.build_relevance = artifacts_pb2.BuildSetupResponse.POINTLESS
+ return controller.RETURN_CODE_SUCCESS
+
+
def _GetImageDir(build_root, target):
"""Return path containing images for the given build target.