From e2e78ba92e6ff5839cdaa62769f8b13c49873c63 Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:28:48 +0200 Subject: [PATCH 1/2] Add timestamps to container logs --- ci/ci.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/ci.py b/ci/ci.py index d430d94..de79712 100755 --- a/ci/ci.py +++ b/ci/ci.py @@ -329,7 +329,7 @@ def _endtest(self, container:Container, tag:str, build_info:dict[str,str], packa runtime = "-" if isinstance(start_time,(float, int)): runtime = f"{time.time() - start_time:.2f}s" - logblob: Any = container.logs().decode("utf-8") + logblob: str = container.logs(timestamps=True).decode("utf-8") self.create_html_ansi_file(logblob, tag, "log") # Generate an html container log file based on the latest logs try: container.remove(force="true") From 4640609d1f8094c1a2739b83b33367e99fa2fba3 Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:42:39 +0200 Subject: [PATCH 2/2] Remove comments --- ci/ci.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/ci.py b/ci/ci.py index de79712..2a47d5a 100755 --- a/ci/ci.py +++ b/ci/ci.py @@ -288,14 +288,13 @@ def container_test(self, tag: str) -> None: sbom: str = self.generate_sbom(tag) - logsfound: bool = self.watch_container_logs(container, tag) # Watch the logs for no more than 5 minutes + logsfound: bool = self.watch_container_logs(container, tag) if not logsfound: self.logger.error("Test of %s FAILED after %.2f seconds", tag, time.time() - start_time) build_info = {"version": "-", "created": "-", "size": "-", "maintainer": "-"} self._endtest(container, tag, build_info, sbom, False, start_time) return - # build_version: str = self.get_build_version(container,tag) # Get the image build version build_info: dict = self.get_build_info(container,tag) # Get the image build info if build_info["version"] == "ERROR": self.logger.error("Test of %s FAILED after %.2f seconds", tag, time.time() - start_time)