sdk: return URIs of created CLs in CreateBinhostCLs
CreateBinhostCLs runs upload_prebuilts to create CLs that point binhost
files at a new SDK. This change:
1. Adds a --output=<path> parameter to upload_prebuilts. When specified,
this causes upload_prebuilts to write a JSON report to the given
path, which contains the URIs of the CLs created by the script.
2. Makes service/sdk.py pass the --output parameter and extract the
CL URIs.
3. Makes api/controller/sdk.py return the URIs to the caller.
BUG=b:196886631
TEST=./run_tests
Change-Id: I0d96ee3a5236f229316f7f8d8fab894e47975781
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3911178
Commit-Queue: Bob Haarman <inglorion@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Bob Haarman <inglorion@chromium.org>
diff --git a/api/controller/sdk.py b/api/controller/sdk.py
index 2249d60..9851b8d 100644
--- a/api/controller/sdk.py
+++ b/api/controller/sdk.py
@@ -20,6 +20,14 @@
output_proto.version.version = 168
+def _CLUris(_input_proto, output_proto, _config):
+ """Add fake CL URIs to a successful response."""
+ output_proto.cls = [
+ "https://crrev.com/fakecl/1",
+ "https://crrev.com/fakecl/2",
+ ]
+
+
@faux.success(_ChrootVersionResponse)
@faux.empty_error
def Create(
@@ -170,16 +178,22 @@
sdk.BuildPrebuilts(chroot)
-@faux.all_empty
+@faux.success(_CLUris)
+@faux.empty_error
@validate.require("prepend_version", "version", "upload_location")
@validate.validation_complete
-def CreateBinhostCLs(input_proto, _output_proto, _config):
+def CreateBinhostCLs(
+ input_proto: "CreateBinhostCLsRequest",
+ output_proto: "CreateBinhostCLsResponse",
+ _config: "api_config.ApiConfig",
+) -> None:
"""Create CLs to update the binhost to point at uploaded prebuilts."""
- sdk.CreateBinhostCLs(
+ uris = sdk.CreateBinhostCLs(
input_proto.prepend_version,
input_proto.version,
input_proto.upload_location,
)
+ output_proto.cls = uris
@faux.all_empty