From 65f4d1912b9e31cfc393cfaa0fafd28bf3d9cab6 Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Sat, 25 Jul 2026 13:50:53 +0530 Subject: [PATCH 1/3] build_manager: shorten build ids and name archives vehicle-board-id Co-authored-by: Cursor --- build_manager/manager.py | 15 +++++++++------ build_manager/progress_updater.py | 4 +++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build_manager/manager.py b/build_manager/manager.py index 60bbc2e..befc8e7 100644 --- a/build_manager/manager.py +++ b/build_manager/manager.py @@ -200,13 +200,12 @@ def __generate_build_id(self, build_info: BuildInfo) -> str: build_info (BuildInfo): The build information object. Returns: - str: The generated build ID (64 characters). + str: The generated build ID (8 characters). """ h = hashlib.md5( f"{build_info}-{time.time_ns()}".encode() - ).hexdigest() - bid = f"{build_info.vehicle_id}-{build_info.board}-{h}" - return bid + ).hexdigest()[:8] + return h def submit_build(self, build_info: BuildInfo) -> str: @@ -460,19 +459,23 @@ def get_build_log_path(self, build_id: str) -> str: 'build.log' ) - def get_build_archive_path(self, build_id: str) -> str: + def get_build_archive_path( + self, build_id: str, vehicle_id: str, board: str + ) -> str: """ Return the path to the build archive. Parameters: build_id (str): The ID of the build. + vehicle_id (str): The vehicle identifier. + board (str): The board identifier. Returns: str: The path to the build archive. """ return os.path.join( self.get_build_artifacts_dir_path(build_id), - f"{build_id}.tar.gz" + f"{vehicle_id}-{board}-{build_id}.tar.gz" ) @staticmethod diff --git a/build_manager/progress_updater.py b/build_manager/progress_updater.py index ee15504..efda989 100644 --- a/build_manager/progress_updater.py +++ b/build_manager/progress_updater.py @@ -186,7 +186,9 @@ def __refresh_running_build_state(self, build_id: str) -> BuildState: # Builder ships the archive post completion # This is irrespective of SUCCESS or FAILURE if not os.path.exists( - bm.get_singleton().get_build_archive_path(build_id) + bm.get_singleton().get_build_archive_path( + build_id, build_info.vehicle_id, build_info.board + ) ): return BuildState.RUNNING From d89285c55e046d77521b8538fef062c75ee4ae73 Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Sat, 25 Jul 2026 13:50:53 +0530 Subject: [PATCH 2/3] builder: use renamed archive path and match tar inner folder Co-authored-by: Cursor --- builder/builder.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/builder/builder.py b/builder/builder.py index 7a16cb1..c687e9a 100644 --- a/builder/builder.py +++ b/builder/builder.py @@ -226,7 +226,9 @@ def __generate_archive(self, build_id: str) -> None: build_id (str): Unique identifier for the build. """ build_info = bm.get_singleton().get_build_info(build_id) - archive_path = bm.get_singleton().get_build_archive_path(build_id) + archive_path = bm.get_singleton().get_build_archive_path( + build_id, build_info.vehicle_id, build_info.board + ) files_to_include = [] @@ -261,10 +263,11 @@ def __generate_archive(self, build_id: str) -> None: ) files_to_include.append(extra_hwdef_path_abs) - # create archive + # create archive (inner folder matches download basename) + folder_name = Path(archive_path).name.removesuffix(".tar.gz") with tarfile.open(archive_path, "w:gz") as tar: for file in files_to_include: - arcname = f"{build_id}/{os.path.basename(file)}" + arcname = f"{folder_name}/{os.path.basename(file)}" self.logger.debug(f"Added {file} as {arcname}") tar.add(file, arcname=arcname) self.logger.info(f"Generated {archive_path}.") From d922c9a8341bed44ae81adfcd3cce9e4f1e32038 Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Sat, 25 Jul 2026 13:50:53 +0530 Subject: [PATCH 3/3] web: serve artifact download using archive basename Co-authored-by: Cursor --- web/api/v1/builds.py | 3 ++- web/services/builds.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/api/v1/builds.py b/web/api/v1/builds.py index 2c68c6a..9f33077 100644 --- a/web/api/v1/builds.py +++ b/web/api/v1/builds.py @@ -1,3 +1,4 @@ +import os from typing import List, Optional from fastapi import ( APIRouter, @@ -219,5 +220,5 @@ async def download_artifact( return FileResponse( path=artifact_path, media_type='application/gzip', - filename=f"{build_id}.tar.gz" + filename=os.path.basename(artifact_path) ) diff --git a/web/services/builds.py b/web/services/builds.py index 9cc6b67..64af64d 100644 --- a/web/services/builds.py +++ b/web/services/builds.py @@ -282,7 +282,9 @@ def get_artifact_path(self, build_id: str) -> Optional[str]: ]: return None - artifact_path = self.manager.get_build_archive_path(build_id) + artifact_path = self.manager.get_build_archive_path( + build_id, build_info.vehicle_id, build_info.board + ) if os.path.exists(artifact_path): return artifact_path