From ff5c2e6710ac942da70f9662f7e1de0d36b1350d Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 27 Nov 2026 09:48:49 +0000 Subject: [PATCH 1/2] fix(ci): probe mirror tags with skopeo inspect --raw MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR 2006's Mirror wait job looped for 6 h on ghcr.io/infinito-nexus/core/mirror/ghcr.io/ggml-org/whisper.cpp:main-arm64-d1be6fde... although the pull_request_target mirror had copied it: the tag is an OCI index holding only arm64, and tag_exists ran skopeo inspect without --raw, which resolves the amd64 runner's platform and fails with 'no image found in image index for architecture amd64'. Both providers now share _manifest_exists, which probes with --raw and counts any manifest or index as present. MEDUSA B603 on the moved subprocess call accepted: fixed argv, no shell, ref from repo role metadata, same call as the two accepted probes it replaces. 🎯 Fix: 92 % 💥 Break: 2 % 💸 Tokens: 95 % ⏱️ Velocity: 92 % 🛡️ Security: 100 % 🏆 Score: 100 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- cli/contributing/mirror/providers.py | 52 ++++++++----------- .../cli/contributing/mirror/test_providers.py | 3 +- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/cli/contributing/mirror/providers.py b/cli/contributing/mirror/providers.py index df65f5f813..46019da0d4 100644 --- a/cli/contributing/mirror/providers.py +++ b/cli/contributing/mirror/providers.py @@ -14,6 +14,26 @@ if TYPE_CHECKING: from utils.docker.image.discovery import ImageRef +def _manifest_exists(ref: str) -> bool: + """ + Args: + ref: the image reference to probe. + + Returns: + True when the registry serves a manifest or index for ``ref``, whatever + architectures it holds; False when it is missing or unreachable. + """ + # Exception: without --raw skopeo resolves the host's platform and fails on + # an index without it, so an arm64-only tag read as missing on amd64 runners. + r = subprocess.run( + ["skopeo", "inspect", "--raw", f"docker://{ref}"], + check=False, + capture_output=True, + text=True, + ) + return r.returncode == 0 + + class RegistryProvider(ABC): @abstractmethod def image_base(self, image: ImageRef) -> str: @@ -64,21 +84,7 @@ class GHCRProvider(RegistryProvider): ) def tag_exists(self, image: ImageRef) -> bool: - """ - Return True if the destination tag already exists in GHCR. - - Uses ``skopeo inspect docker://``, whose exit code is 0 when the - tag exists and non-zero when it does not exist or cannot be accessed - (auth/network). - """ - dest = self.image_ref(image) - r = subprocess.run( - ["skopeo", "inspect", f"docker://{dest}"], - check=False, - capture_output=True, - text=True, - ) - return r.returncode == 0 + return _manifest_exists(self.image_ref(image)) def is_stale(self, image: ImageRef) -> bool: """Return True if the mirrored tag no longer matches its upstream tag. @@ -169,21 +175,7 @@ class GiteaProvider(RegistryProvider): return f"{self.registry}/{self.namespace}/{self.prefix}/{image.registry}/{image.name}" def tag_exists(self, image: ImageRef) -> bool: - """ - Return True if the destination tag already exists in the target registry. - - Uses ``skopeo inspect docker://``, whose exit code is 0 when the - tag exists and non-zero when it does not exist or cannot be accessed - (auth/network). - """ - dest = self.image_ref(image) - r = subprocess.run( - ["skopeo", "inspect", f"docker://{dest}"], - check=False, - capture_output=True, - text=True, - ) - return r.returncode == 0 + return _manifest_exists(self.image_ref(image)) def mirror(self, image: ImageRef) -> None: dest = self.image_ref(image) diff --git a/tests/unit/python/cli/contributing/mirror/test_providers.py b/tests/unit/python/cli/contributing/mirror/test_providers.py index 0dfdaf344d..200c39f96d 100644 --- a/tests/unit/python/cli/contributing/mirror/test_providers.py +++ b/tests/unit/python/cli/contributing/mirror/test_providers.py @@ -147,7 +147,8 @@ class TestGHCRProviderImageRef(unittest.TestCase): self.assertTrue(self.provider.tag_exists(NODE)) self.assertEqual( - run.call_args.args[0], ["skopeo", "inspect", f"docker://{NODE_MIRROR}"] + run.call_args.args[0], + ["skopeo", "inspect", "--raw", f"docker://{NODE_MIRROR}"], ) From 4a9c806664694e81dacd6a00a499d58be561cc30 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 27 Nov 2026 10:02:40 +0000 Subject: [PATCH 2/2] chore(ci): drop the comment on the mirror manifest probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator review note on the previous commit: no Exception comment on _manifest_exists; its Returns doc already states that any manifest or index counts. MEDUSA B603 re-accepted at the shifted line. 🎯 Fix: 92 % 💥 Break: 2 % 💸 Tokens: 95 % ⏱️ Velocity: 92 % 🛡️ Security: 100 % 🏆 Score: 100 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- cli/contributing/mirror/providers.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cli/contributing/mirror/providers.py b/cli/contributing/mirror/providers.py index 46019da0d4..09b1e4d6ca 100644 --- a/cli/contributing/mirror/providers.py +++ b/cli/contributing/mirror/providers.py @@ -23,8 +23,6 @@ def _manifest_exists(ref: str) -> bool: True when the registry serves a manifest or index for ``ref``, whatever architectures it holds; False when it is missing or unreachable. """ - # Exception: without --raw skopeo resolves the host's platform and fails on - # an index without it, so an arm64-only tag read as missing on amd64 runners. r = subprocess.run( ["skopeo", "inspect", "--raw", f"docker://{ref}"], check=False,