From 58e2b47ab92f3b040f8a22c6ba6b38efdea500af Mon Sep 17 00:00:00 2001 From: Gurpreet Singh Date: Mon, 22 May 2023 14:38:21 +0100 Subject: [PATCH] Add 1 MB max_size constraint on gantry metadata files. The metadata files are downloaded by gantry gate and hence their size should not be too high. On discussion with Gantry team, 1 MB size was decided for the time being. This size can possibly be increased, if the download only happens once per build in gantry. Bug: 242316893 Test: Build passes. Throws build error if metadata file size increases 1 MB. atest --host mainline_modules_sdks_test --no-bazel-mode Change-Id: I2f7a3cc55a34cd2c94a3ce4f20af96be757690c2 --- build/mainline_modules_sdks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/mainline_modules_sdks.py b/build/mainline_modules_sdks.py index 81e06fa..12a0dfd 100755 --- a/build/mainline_modules_sdks.py +++ b/build/mainline_modules_sdks.py @@ -622,6 +622,9 @@ java_sdk_library_import {{ "w") as gantry_metadata_json_file_object: gantry_metadata_json_file_object.write(gantry_metadata_json_object) + if os.path.getsize(sdk_metadata_json_file) > 1048576: # 1 MB + raise ValueError("Metadata file size should not exceed 1 MB.\n") + def get_module_extension_version(self): return int( subprocess.run([