mirror of
https://github.com/linuxserver/docker-ci.git
synced 2026-02-05 11:08:54 +08:00
Set correct build url based on if its a dev of pr image.
Add test for build_url function.
This commit is contained in:
parent
bef009e43c
commit
e1575730d9
21
ci/ci.py
21
ci/ci.py
@ -374,7 +374,8 @@ class CI(SetEnvs):
|
||||
"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 @@ class CI(SetEnvs):
|
||||
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
|
||||
|
||||
@ -576,7 +576,7 @@
|
||||
{% endif %}
|
||||
<h2 class="section-header-h2">
|
||||
{% if report_status.lower() == "pass" %}
|
||||
<a target="_blank" href="https://ghcr.io/{{ image }}:{{ tag }}">{{ image }}:{{ tag }}</a>
|
||||
<a target="_blank" href="{{ report_containers[tag]['build_url'] }}">{{ image }}:{{ tag }}</a>
|
||||
{% else %}
|
||||
{{ image }}:{{ tag }}
|
||||
{% endif %}
|
||||
|
||||
@ -174,3 +174,12 @@ def test_upload_file(ci: CI) -> None:
|
||||
ci.s3_client.create_bucket(Bucket=ci.bucket)
|
||||
# Upload a file to the bucket
|
||||
ci.upload_file("tests/log_blob.log", "log_blob.log", {"ContentType": "text/plain", "ACL": "public-read"})
|
||||
|
||||
def test_make_build_url(ci: CI) -> None:
|
||||
ci.image = "linuxserver/plex"
|
||||
tag = "amd64-nightly-5.10.1.9109-ls85"
|
||||
assert ci.make_build_url(tag) == f"https://ghcr.io/{ci.image}:{tag}"
|
||||
ci.image = "lsiodev/plex"
|
||||
assert ci.make_build_url(tag) == f"https://ghcr.io/linuxserver/lsiodev-plex:{tag}"
|
||||
ci.image = "lspipepr/plex"
|
||||
assert ci.make_build_url(tag) == f"https://ghcr.io/linuxserver/lspipepr-plex:{tag}"
|
||||
Loading…
x
Reference in New Issue
Block a user