Skip to content

Commit d994c20

Browse files
committed
web: allow failed builds artifact download from backend
1 parent 3d4a2ff commit d994c20

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

web/api/v1/builds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ async def download_artifact(
207207
208208
Raises:
209209
404: Build not found
210-
404: Artifact not available (build not completed successfully)
210+
404: Artifact not available (build not completed)
211211
"""
212212
artifact_path = service.get_artifact_path(build_id)
213213
if not artifact_path:
214214
raise HTTPException(
215215
status_code=404,
216216
detail=(
217217
f"Artifact not available for build '{build_id}'. "
218-
"Build may not be completed or successful."
218+
"Build may not be completed."
219219
)
220220
)
221221
return FileResponse(

web/services/builds.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ def get_artifact_path(self, build_id: str) -> Optional[str]:
278278
if build_info is None:
279279
return None
280280

281-
# Only return artifact if build was successful
282-
if build_info.progress.state.name != "SUCCESS":
281+
# Return early if build is still ongoing
282+
if build_info.progress.state in [
283+
build_manager.BuildState.PENDING,
284+
build_manager.BuildState.RUNNING,
285+
]:
283286
return None
284287

285288
artifact_path = self.manager.get_build_archive_path(build_id)

0 commit comments

Comments
 (0)