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
This commit is contained in:
Gurpreet Singh
2023-05-22 14:38:21 +01:00
parent a465ee51e8
commit 58e2b47ab9

View File

@@ -622,6 +622,9 @@ java_sdk_library_import {{
"w") as gantry_metadata_json_file_object: "w") as gantry_metadata_json_file_object:
gantry_metadata_json_file_object.write(gantry_metadata_json_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): def get_module_extension_version(self):
return int( return int(
subprocess.run([ subprocess.run([