Explorar el Código

web: allow failed builds artifact download from backend

Shiv Tyagi hace 1 mes
padre
commit
d994c20214
Se han modificado 2 ficheros con 7 adiciones y 4 borrados
  1. 2 2
      web/api/v1/builds.py
  2. 5 2
      web/services/builds.py

+ 2 - 2
web/api/v1/builds.py

@@ -207,7 +207,7 @@ async def download_artifact(
 
     Raises:
         404: Build not found
-        404: Artifact not available (build not completed successfully)
+        404: Artifact not available (build not completed)
     """
     artifact_path = service.get_artifact_path(build_id)
     if not artifact_path:
@@ -215,7 +215,7 @@ async def download_artifact(
             status_code=404,
             detail=(
                 f"Artifact not available for build '{build_id}'. "
-                "Build may not be completed or successful."
+                "Build may not be completed."
             )
         )
     return FileResponse(

+ 5 - 2
web/services/builds.py

@@ -278,8 +278,11 @@ class BuildsService:
         if build_info is None:
             return None
 
-        # Only return artifact if build was successful
-        if build_info.progress.state.name != "SUCCESS":
+        # Return early if build is still ongoing
+        if build_info.progress.state in [
+            build_manager.BuildState.PENDING,
+            build_manager.BuildState.RUNNING,
+        ]:
             return None
 
         artifact_path = self.manager.get_build_archive_path(build_id)