Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/api/v1/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ 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:
raise HTTPException(
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(
Expand Down
7 changes: 5 additions & 2 deletions web/services/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ def get_artifact_path(self, build_id: str) -> Optional[str]:
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)
Expand Down