From e1575730d9916983033f8849fdf05487cf4eb05e Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:28:35 +0200 Subject: [PATCH] Set correct build url based on if its a dev of pr image. Add test for build_url function. --- ci/ci.py | 21 ++++++++++++++++++++- ci/template.html | 2 +- tests/test_ci.py | 9 +++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ci/ci.py b/ci/ci.py index 312c617..e5a815a 100755 --- a/ci/ci.py +++ b/ci/ci.py @@ -374,7 +374,8 @@ def _endtest(self, container:Container, tag:str, build_info:dict[str,str], packa "build_info": build_info, "test_results": self.tag_report_tests[tag]["test"], "test_success": test_success, - "runtime": runtime + "runtime": runtime, + "build_url": self.make_build_url(tag) } self.report_containers[tag]["has_warnings"] = any(warning[1] for warning in self.report_containers[tag]["warnings"].items()) @@ -892,6 +893,24 @@ def create_docker_client(self) -> DockerClient|None: return docker.from_env() except Exception: self.logger.error("Failed to create Docker client!") + + def make_build_url(self, tag) -> str: + """Create a build url for the image + Args: + tag (str): The tag we are testing + + Returns: + str: Returns a build url + """ + _, container_name = self.image.split("/") + match self.image: + case _ if "lspipepr" in self.image: + return f"https://ghcr.io/linuxserver/lspipepr-{container_name}:{tag}" + case _ if "lsiodev" in self.image: + return f"https://ghcr.io/linuxserver/lsiodev-{container_name}:{tag}" + case _: + return f"https://ghcr.io/{self.image}:{tag}" + class CIError(Exception): pass diff --git a/ci/template.html b/ci/template.html index 991fb55..1262ac5 100644 --- a/ci/template.html +++ b/ci/template.html @@ -576,7 +576,7 @@