Skip to content

Commit 2669fe0

Browse files
committed
update ci to fall back if images are not found and bail on package compare if not available modernize styling of test page
1 parent d3466db commit 2669fe0

2 files changed

Lines changed: 665 additions & 500 deletions

File tree

ci/ci.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,14 @@ def get_sbom_syft(self, tag: str, override_image: str = None) -> str | CITestRes
635635
start_time = time.time()
636636
platform: str = self.get_platform(tag)
637637
target_image = override_image if override_image else f"{self.image}:{tag}"
638+
try:
639+
self.client.images.get(target_image)
640+
except ImageNotFound:
641+
self.logger.error("Image %s not found, cannot generate Syft SBOM", target_image)
642+
return CITestResult.ERROR
643+
except APIError as error:
644+
self.logger.error("API error while checking for image %s: %s", target_image, error)
645+
return CITestResult.ERROR
638646
cmd = f"{target_image}" if override_image else f"{target_image} --platform=linux/{platform}"
639647
syft:Container = self.client.containers.run(image=f"ghcr.io/anchore/syft:{self.syft_image_tag}",command=cmd,
640648
detach=True, volumes={"/var/run/docker.sock": {"bind": "/var/run/docker.sock", "mode": "rw"}})
@@ -1080,6 +1088,9 @@ def get_package_diff(self, current_sbom: str | CITestResult) -> str:
10801088
if self.release_type == "stable":
10811089
repo_api = f"https://api.github.com/repos/linuxserver/docker-{container_name}/releases/latest"
10821090
resp = requests.get(repo_api, timeout=10)
1091+
if resp.status_code == 404:
1092+
self.logger.info("No release found for %s, skipping package diff", container_name)
1093+
return ""
10831094
if resp.status_code != 200:
10841095
self.logger.warning("Could not fetch latest release info from GitHub: %s", resp.status_code)
10851096
return ""
@@ -1091,6 +1102,9 @@ def get_package_diff(self, current_sbom: str | CITestResult) -> str:
10911102
raw_sbom_url = f"https://raw.githubusercontent.com/linuxserver/docker-{container_name}/refs/heads/{self.ls_branch}/package_versions.txt"
10921103
# Get remote SBOM
10931104
resp_sbom = requests.get(raw_sbom_url, timeout=10)
1105+
if resp_sbom.status_code == 404:
1106+
self.logger.info("No package_versions.txt found at %s, skipping package diff", raw_sbom_url)
1107+
return ""
10941108
if resp_sbom.status_code != 200:
10951109
self.logger.warning("Could not fetch remote SBOM from %s: %s", raw_sbom_url, resp_sbom.status_code)
10961110
return ""

0 commit comments

Comments
 (0)