Skip to content

Commit ca3db67

Browse files
committed
hotfix
1 parent 2177720 commit ca3db67

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

ci/ci.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -776,22 +776,22 @@ def upload_file(self, file_path:str, object_name:str, content_type:dict) -> None
776776
self.s3_client.upload_file(file_path, self.bucket, f"{release_dir}/{object_name}", ExtraArgs=content_type)
777777

778778
def log_upload(self) -> None:
779-
"""Upload the ci.log to S3
780-
781-
Raises:
782-
Exception: S3UploadFailedError
783-
Exception: ClientError
784-
"""
779+
"""Upload the ci.log to S3..."""
785780
self.logger.info("Uploading logs")
786781
try:
787-
shutil.copyfile("ci.log", f"{self.outdir}/ci.log")
788-
self.upload_file(f"{self.outdir}/ci.log", "ci.log", {"ContentType": "text/plain", "ACL": "public-read"})
789-
with open(f"{self.outdir}/ci.log","r", encoding="utf-8") as logs:
782+
log_source_path = "ci.log"
783+
log_dest_path = f"{self.outdir}/ci.log"
784+
785+
if not os.path.exists(log_dest_path):
786+
shutil.copyfile(log_source_path, log_dest_path)
787+
788+
self.upload_file(log_dest_path, "ci.log", {"ContentType": "text/plain", "ACL": "public-read"})
789+
with open(log_dest_path, "r", encoding="utf-8") as logs:
790790
blob: str = logs.read()
791-
self.create_html_ansi_file(blob,"python","log")
791+
self.create_html_ansi_file(blob, "python", "log")
792792
self.upload_file(f"{self.outdir}/python.log.html", "python.log.html", {"ContentType": "text/html", "ACL": "public-read"})
793-
except (S3UploadFailedError, ClientError):
794-
self.logger.exception("Failed to upload the CI logs!")
793+
except (S3UploadFailedError, ClientError, FileNotFoundError) as e:
794+
self.logger.exception(f"Failed to upload the CI logs! Error: {e}")
795795

796796
def _add_test_result(self, tag:str, test:str, status:str, message:str, start_time:float|int = 0.0) -> None:
797797
"""Add a test result to the report

0 commit comments

Comments
 (0)