BinhostService: RegenBuildCache sans git operations.
Update the RegenBuildCache service to be able to operate without
performing the git operations itself. Instead, return a list
of overlays that have modifications that need to be committed.
BUG=chromium:986281
TEST=run_tests, manually ran endpoint
Change-Id: I5737b3f7a8928f976e1294310a20b3facf12cb06
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1754680
Tested-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
Reviewed-by: Evan Hernandez <evanhernandez@chromium.org>
diff --git a/api/controller/binhost.py b/api/controller/binhost.py
index 7bf4bfe..e5b3379 100644
--- a/api/controller/binhost.py
+++ b/api/controller/binhost.py
@@ -146,15 +146,20 @@
@validate.require('overlay_type')
@validate.is_in('overlay_type', _OVERLAY_TYPE_TO_NAME)
@validate.validation_complete
-def RegenBuildCache(input_proto, _output_proto, _config):
+def RegenBuildCache(input_proto, output_proto, _config):
"""Regenerate the Build Cache for a build target.
See BinhostService documentation in api/proto/binhost.proto.
Args:
input_proto (RegenBuildCacheRequest): The input proto.
- _output_proto (RegenBuildCacheResponse): The output proto.
+ output_proto (RegenBuildCacheResponse): The output proto.
_config (api_config.ApiConfig): The API call config.
"""
+ chroot = controller_util.ParseChroot(input_proto.chroot)
overlay_type = input_proto.overlay_type
- binhost.RegenBuildCache(_OVERLAY_TYPE_TO_NAME[overlay_type])
+ overlays = binhost.RegenBuildCache(chroot,
+ _OVERLAY_TYPE_TO_NAME[overlay_type])
+
+ for overlay in overlays:
+ output_proto.modified_overlays.add().path = overlay