From aaaf2eb9671d8ddd7f983db0c9a9f781cf68af15 Mon Sep 17 00:00:00 2001 From: Gage Krumbach Date: Mon, 30 Nov 2026 13:49:24 -0600 Subject: [PATCH] fix(upstream): look for OpenShell images on Quay, then on GHCR OpenShell publishes releases to quay.io/ai-openshell from v0.1.10 on. ghcr.io/nvidia/openshell is frozen at v0.1.9 and v0.1.10-pre.1 to pre.3, so Follow upstream found v0.1.10 every day and reported "has not published its gateway image yet", and main stayed on 0.1.9. The plan now looks a release up in each image home, Quay first, and pins both images from the first home that has the gateway. Releases from before the move still resolve to GHCR. An outage on Quay stops the run instead of falling back. The e2e stack picks the home by version for OPENSHELL_VERSION, and the comments say where a dev gateway pulls its sandbox image now. Closes #152 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Gage Krumbach --- .github/workflows/ci.yml | 2 +- deploy/ci/docker-compose.e2e.yml | 2 +- deploy/ci/e2e-stack.sh | 19 ++++++++-- deploy/ci/gateway-pins.json | 4 +- deploy/ci/upstream/pins.py | 5 ++- deploy/ci/upstream/plan.py | 35 +++++++++++++----- deploy/ci/upstream/tests/support.py | 22 ++++++++--- deploy/ci/upstream/tests/test_plan.py | 45 ++++++++++++++++++++++- deploy/ci/upstream/tests/test_upstream.py | 20 +++++++--- deploy/ci/upstream/upstream.py | 20 +++++++--- 10 files changed, 140 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d9bc978..5660debb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,7 +207,7 @@ jobs: # # The gateway is a RELEASE pinned by digest: a stable release, or on a prep # branch a pre-release. Never a `dev` build. A dev gateway resolves a moving - # ghcr.io/nvidia/openshell/sandbox:dev image at runtime, so even pinned by + # quay.io/ai-openshell/sandbox:dev image at runtime, so even pinned by # digest it drifts with upstream HEAD, which is what turned this job red on # main on 2026-10-02 with no change on our side. # diff --git a/deploy/ci/docker-compose.e2e.yml b/deploy/ci/docker-compose.e2e.yml index eb0d0504..6cf6903e 100644 --- a/deploy/ci/docker-compose.e2e.yml +++ b/deploy/ci/docker-compose.e2e.yml @@ -7,7 +7,7 @@ # (Docker-outside-of-Docker) through the mounted Docker socket. services: gateway: - image: ${OPENSHELL_GATEWAY_IMAGE:-ghcr.io/nvidia/openshell/gateway:latest} + image: ${OPENSHELL_GATEWAY_IMAGE:-quay.io/ai-openshell/gateway:latest} command: [] user: "0" ports: diff --git a/deploy/ci/e2e-stack.sh b/deploy/ci/e2e-stack.sh index 8285ecb4..37137134 100755 --- a/deploy/ci/e2e-stack.sh +++ b/deploy/ci/e2e-stack.sh @@ -34,17 +34,28 @@ pinned() { # OPENSHELL_GATEWAY_IMAGE / OPENSHELL_SUPERVISOR_IMAGE as tag@digest. The last # resort, `latest`, is the newest upstream RELEASE (`dev` is upstream HEAD): a # moving tag, used only when the pins cannot be read. +# +# Upstream publishes to quay.io/ai-openshell from v0.1.10 on. ghcr.io/nvidia/openshell +# is frozen and holds only the releases before that: v0.1.9 and older, and +# v0.1.10-pre.1 to pre.3 (ai-openshell/console#152). +image_home() { + case "$1" in + 0.0.* | 0.1.[0-9] | 0.1.[0-9]-* | 0.1.10-pre.[123]) echo "ghcr.io/nvidia/openshell" ;; + *) echo "quay.io/ai-openshell" ;; + esac +} if [ -n "${OPENSHELL_VERSION:-}" ]; then - default_gateway="ghcr.io/nvidia/openshell/gateway:${OPENSHELL_VERSION}" - default_supervisor="ghcr.io/nvidia/openshell/supervisor:${OPENSHELL_VERSION}" + home="$(image_home "$OPENSHELL_VERSION")" + default_gateway="${home}/gateway:${OPENSHELL_VERSION}" + default_supervisor="${home}/supervisor:${OPENSHELL_VERSION}" default_schema="" else default_gateway="$(pinned gateway_image)" default_supervisor="$(pinned supervisor_image)" default_schema="$(pinned config_schema)" fi -export OPENSHELL_GATEWAY_IMAGE="${OPENSHELL_GATEWAY_IMAGE:-${default_gateway:-ghcr.io/nvidia/openshell/gateway:latest}}" -export OPENSHELL_SUPERVISOR_IMAGE="${OPENSHELL_SUPERVISOR_IMAGE:-${default_supervisor:-ghcr.io/nvidia/openshell/supervisor:latest}}" +export OPENSHELL_GATEWAY_IMAGE="${OPENSHELL_GATEWAY_IMAGE:-${default_gateway:-quay.io/ai-openshell/gateway:latest}}" +export OPENSHELL_SUPERVISOR_IMAGE="${OPENSHELL_SUPERVISOR_IMAGE:-${default_supervisor:-quay.io/ai-openshell/supervisor:latest}}" # The workload image is pinned by digest in gateway-pins.json. Fall back to the # moving tag only when the pins cannot be read. COMPAT_SANDBOX_IMAGE="${COMPAT_SANDBOX_IMAGE:-$(pinned sandbox_image)}" diff --git a/deploy/ci/gateway-pins.json b/deploy/ci/gateway-pins.json index 15f7d1b5..ce2de3c0 100644 --- a/deploy/ci/gateway-pins.json +++ b/deploy/ci/gateway-pins.json @@ -17,8 +17,10 @@ "", "gateway_image, supervisor_image: that release's images, pinned by digest", "(tag@digest: the tag is for readers, the digest is what gets pulled).", + "From v0.1.10 upstream publishes them to quay.io/ai-openshell;", + "ghcr.io/nvidia/openshell is frozen and holds only the older releases.", "Never a dev build: a dev gateway resolves", - "ghcr.io/nvidia/openshell/sandbox:dev at runtime, so even pinned by digest", + "quay.io/ai-openshell/sandbox:dev at runtime, so even pinned by digest", "it drifts with upstream HEAD, which broke main on 2026-10-02.", "", "sandbox_image: the workload image compat sandboxes run. It publishes no", diff --git a/deploy/ci/upstream/pins.py b/deploy/ci/upstream/pins.py index 9841fd63..ddcbbf13 100644 --- a/deploy/ci/upstream/pins.py +++ b/deploy/ci/upstream/pins.py @@ -13,7 +13,8 @@ pin a pre-release is not decided here: require_stable() is the check CI runs for pull requests into `main` and `release/**`; * dev / HEAD builds are never pinned. A dev gateway resolves - ghcr.io/nvidia/openshell/sandbox:dev at runtime, so even a digest-pinned + quay.io/ai-openshell/sandbox:dev at runtime (ghcr.io/nvidia/openshell/sandbox:dev + before v0.1.10), so even a digest-pinned dev build drifts with upstream HEAD. That is what broke main on 2026-10-02. """ @@ -171,7 +172,7 @@ def validate(doc, schemas=None, go_mod_version=None): elif isinstance(release, str) and ("dev" in release or release in MOVING_TAGS): problems.append( "release %r is a dev build, which is never pinned. A dev gateway resolves " - "ghcr.io/nvidia/openshell/sandbox:dev at runtime, so even pinned by digest it " + "quay.io/ai-openshell/sandbox:dev at runtime, so even pinned by digest it " "drifts with upstream HEAD." % (release,) ) else: diff --git a/deploy/ci/upstream/plan.py b/deploy/ci/upstream/plan.py index 6645355a..153b4b7e 100644 --- a/deploy/ci/upstream/plan.py +++ b/deploy/ci/upstream/plan.py @@ -18,7 +18,7 @@ import pins import versions -from upstream import GATEWAY_REPOSITORY, REGISTRY, SDK_MODULE, SDK_URL, SUPERVISOR_REPOSITORY +from upstream import GATEWAY_IMAGE, IMAGE_HOMES, SDK_MODULE, SDK_URL, SUPERVISOR_IMAGE class PlanError(Exception): @@ -26,14 +26,31 @@ class PlanError(Exception): def _images(upstream, version): - """(gateway ref, supervisor ref, what is missing).""" - refs = [] - for name, repository in (("gateway", GATEWAY_REPOSITORY), ("supervisor", SUPERVISOR_REPOSITORY)): - digest = upstream.image_digest(repository, version) - if digest is None: - return None, None, "upstream has tagged v%s but has not published its %s image yet" % (version, name) - refs.append(pins.image_ref("%s/%s" % (REGISTRY, repository), version, digest)) - return refs[0], refs[1], None + """(gateway ref, supervisor ref, what is missing). + + The release is looked for in each of upstream's image homes, newest + first, and both images are pinned from the first home that has its + gateway: a release is published to one home whole, never split. + """ + for home in IMAGE_HOMES: + gateway = upstream.image_digest("%s/%s" % (home, GATEWAY_IMAGE), version) + if gateway is None: + continue + supervisor = upstream.image_digest("%s/%s" % (home, SUPERVISOR_IMAGE), version) + if supervisor is None: + return None, None, "upstream has published v%s's gateway image to %s but not its supervisor image yet" % ( + version, + home, + ) + return ( + pins.image_ref("%s/%s" % (home, GATEWAY_IMAGE), version, gateway), + pins.image_ref("%s/%s" % (home, SUPERVISOR_IMAGE), version, supervisor), + None, + ) + return None, None, "upstream has tagged v%s but has not published its gateway image yet (looked in %s)" % ( + version, + " and ".join(IMAGE_HOMES), + ) def _sdk(upstream, version): diff --git a/deploy/ci/upstream/tests/support.py b/deploy/ci/upstream/tests/support.py index e7634b1e..17112c14 100644 --- a/deploy/ci/upstream/tests/support.py +++ b/deploy/ci/upstream/tests/support.py @@ -30,6 +30,8 @@ FIXTURES = os.path.join(HERE, "fixtures") REPO_ROOT = os.path.abspath(os.path.join(HERE, "..", "..", "..", "..")) +QUAY = "quay.io/ai-openshell" +GHCR = "ghcr.io/nvidia/openshell" SANDBOX = "ghcr.io/nvidia/openshell-community/sandboxes/base:latest@sha256:" + "5a" * 32 README_BEGIN = "" README_END = "" @@ -132,11 +134,21 @@ def sdk_tags(self): return "\n".join(self.data["sdk_tags"]) + "\n" def image_digest(self, repository, tag): - key = "%s:%s" % (repository.rsplit("/", 1)[-1], tag) - self.digest_lookups.append(key) - if key in self.data.get("outage", []): - raise upstream.UpstreamError("ghcr.io/%s:%s: registry answered HTTP 503" % (repository, tag)) - return self.data["images"].get(key) + """A fixture's images are keyed by the whole reference + (`quay.io/ai-openshell/gateway:0.1.10`) or, for the GHCR home that + every release up to 0.1.9 is in, by `name:tag` alone.""" + reference = "%s:%s" % (repository, tag) + self.digest_lookups.append(reference) + short = None + if repository.startswith(GHCR + "/"): + short = "%s:%s" % (repository.rsplit("/", 1)[-1], tag) + outage = self.data.get("outage", []) + if reference in outage or short in outage: + raise upstream.UpstreamError("%s: registry answered HTTP 503" % reference) + images = self.data["images"] + if reference in images: + return images[reference] + return images.get(short) if short else None def upstream_data(tags=None, images=None, outage=None, drop=(), sdk_missing=()): diff --git a/deploy/ci/upstream/tests/test_plan.py b/deploy/ci/upstream/tests/test_plan.py index 04a07a5f..4af36b79 100644 --- a/deploy/ci/upstream/tests/test_plan.py +++ b/deploy/ci/upstream/tests/test_plan.py @@ -54,7 +54,14 @@ def test_its_images_are_resolved_to_digests_once(self): ) self.assertTrue(target["supervisor_image"].startswith("ghcr.io/nvidia/openshell/supervisor:0.1.4-pre.2@sha256:")) # Only the target is looked up. Nothing else is tested, so nothing else is asked. - self.assertEqual(self.fake.digest_lookups, ["gateway:0.1.4-pre.2", "supervisor:0.1.4-pre.2"]) + self.assertEqual( + self.fake.digest_lookups, + [ + "quay.io/ai-openshell/gateway:0.1.4-pre.2", + "ghcr.io/nvidia/openshell/gateway:0.1.4-pre.2", + "ghcr.io/nvidia/openshell/supervisor:0.1.4-pre.2", + ], + ) def test_the_workload_image_and_the_config_schema_are_carried(self): doc = support.pins_of_2026_10_09() @@ -130,6 +137,42 @@ def test_a_tag_whose_images_are_not_published_yet_is_not_ready(self): self.assertIsNone(target["gateway_image"]) # It does not fall back to an older release that does have images. + def test_a_release_on_quay_is_pinned_from_quay(self): + # From v0.1.10 upstream publishes to quay.io/ai-openshell only (#152). + images = { + "quay.io/ai-openshell/gateway:0.1.10": support.digest("qg"), + "quay.io/ai-openshell/supervisor:0.1.10": support.digest("qs"), + } + made, _ = build(tags=["v0.1.10"], images=images) + target = made["target"] + self.assertTrue(target["ready"]) + self.assertEqual(target["gateway_image"], "quay.io/ai-openshell/gateway:0.1.10@" + support.digest("qg")) + self.assertEqual(target["supervisor_image"], "quay.io/ai-openshell/supervisor:0.1.10@" + support.digest("qs")) + + def test_quay_wins_when_both_homes_have_the_release(self): + # Not seen yet, but a re-publish could put a release in both. Quay is + # where upstream publishes now. + images = dict(images_for("0.1.10-pre.3")) + images["quay.io/ai-openshell/gateway:0.1.10-pre.3"] = support.digest("qg") + images["quay.io/ai-openshell/supervisor:0.1.10-pre.3"] = support.digest("qs") + made, _ = build(requested="0.1.10-pre.3", tags=["v0.1.10-pre.3"], images=images) + self.assertTrue(made["target"]["gateway_image"].startswith("quay.io/ai-openshell/gateway:0.1.10-pre.3@")) + self.assertTrue(made["target"]["supervisor_image"].startswith("quay.io/ai-openshell/supervisor:")) + + def test_a_release_is_never_pinned_half_from_each_home(self): + images = { + "quay.io/ai-openshell/gateway:0.1.10": support.digest("qg"), + "supervisor:0.1.10": support.digest("s"), + } + made, _ = build(tags=["v0.1.10"], images=images) + self.assertFalse(made["target"]["ready"]) + self.assertIn("supervisor image", made["target"]["waiting_for"]) + self.assertIn("quay.io/ai-openshell", made["target"]["waiting_for"]) + + def test_an_outage_on_quay_stops_the_run_rather_than_falling_back(self): + with self.assertRaises(upstream.UpstreamError): + build(tags=["v0.1.10"], images=images_for("0.1.10"), outage=["quay.io/ai-openshell/gateway:0.1.10"]) + def test_a_missing_supervisor_image_is_not_ready_either(self): made, _ = build(tags=["v0.1.4"], images={"gateway:0.1.4": support.digest("g")}) self.assertFalse(made["target"]["ready"]) diff --git a/deploy/ci/upstream/tests/test_upstream.py b/deploy/ci/upstream/tests/test_upstream.py index 7ae27ae5..1d865626 100644 --- a/deploy/ci/upstream/tests/test_upstream.py +++ b/deploy/ci/upstream/tests/test_upstream.py @@ -51,7 +51,7 @@ class ImageDigest(unittest.TestCase): def lookup(self, returncode=0, stdout="", stderr=""): done = subprocess.CompletedProcess(args=[], returncode=returncode, stdout=stdout, stderr=stderr) with mock.patch("subprocess.run", return_value=done) as run: - digest = upstream.Upstream().image_digest(upstream.GATEWAY_REPOSITORY, "0.1.4") + digest = upstream.Upstream().image_digest("ghcr.io/nvidia/openshell/gateway", "0.1.4") return digest, run def test_asks_the_registry_through_buildx_and_pulls_nothing(self): @@ -73,12 +73,12 @@ def test_a_registry_that_is_down_is_an_error(self): def test_a_missing_docker_binary_is_an_error(self): with mock.patch("subprocess.run", side_effect=OSError("docker: not found")): with self.assertRaises(upstream.UpstreamError): - upstream.Upstream().image_digest(upstream.GATEWAY_REPOSITORY, "0.1.4") + upstream.Upstream().image_digest("ghcr.io/nvidia/openshell/gateway", "0.1.4") def test_a_lookup_that_hangs_is_an_error(self): with mock.patch("subprocess.run", side_effect=subprocess.TimeoutExpired(["docker"], 1)): with self.assertRaises(upstream.UpstreamError): - upstream.Upstream().image_digest(upstream.SUPERVISOR_REPOSITORY, "0.1.4") + upstream.Upstream().image_digest("ghcr.io/nvidia/openshell/supervisor", "0.1.4") class ReleaseTags(unittest.TestCase): @@ -107,8 +107,18 @@ def test_sdk_tags_are_read_from_sdk_go(self): with mock.patch("subprocess.check_output", return_value="") as check_output: upstream.Upstream().sdk_tags() self.assertEqual(check_output.call_args[0][0], ["git", "ls-remote", "--tags", upstream.SDK_REPO]) - self.assertEqual(upstream.GATEWAY_REPOSITORY, "nvidia/openshell/gateway") - self.assertEqual(upstream.SUPERVISOR_REPOSITORY, "nvidia/openshell/supervisor") + + def test_images_are_looked_for_on_quay_first_then_on_the_frozen_ghcr(self): + # ai-openshell/console#152: releases from v0.1.10 are on Quay only; + # v0.1.9 and older are on GHCR only. + self.assertEqual(upstream.IMAGE_HOMES, ("quay.io/ai-openshell", "ghcr.io/nvidia/openshell")) + self.assertEqual((upstream.GATEWAY_IMAGE, upstream.SUPERVISOR_IMAGE), ("gateway", "supervisor")) + + def test_the_whole_reference_is_asked_for(self): + done = subprocess.CompletedProcess(args=[], returncode=0, stdout=manifest(), stderr="") + with mock.patch("subprocess.run", return_value=done) as run: + upstream.Upstream().image_digest("quay.io/ai-openshell/gateway", "0.1.10") + self.assertEqual(run.call_args[0][0][4], "quay.io/ai-openshell/gateway:0.1.10") if __name__ == "__main__": diff --git a/deploy/ci/upstream/upstream.py b/deploy/ci/upstream/upstream.py index 200321e8..9ea9118a 100644 --- a/deploy/ci/upstream/upstream.py +++ b/deploy/ci/upstream/upstream.py @@ -23,9 +23,16 @@ # Where the SDK lived until then: a directory of the core repository. A # go.mod that still requires it is moved off it by the next pin move. LEGACY_SDK_MODULE = "github.com/NVIDIA/OpenShell/sdk/go" -REGISTRY = "ghcr.io" -GATEWAY_REPOSITORY = "nvidia/openshell/gateway" -SUPERVISOR_REPOSITORY = "nvidia/openshell/supervisor" +# Where upstream publishes a release's gateway and supervisor images, newest +# home first. Since the move to ai-openshell/openshell, releases go to +# quay.io/ai-openshell (v0.1.10 is the first stable release there). +# ghcr.io/nvidia/openshell is frozen: it keeps v0.1.9 and older, and +# v0.1.10-pre.1 to pre.3, and receives nothing newer. A release is looked up +# in each home in turn and pinned from the first one that has it, so a +# release from before the move still resolves to GHCR. +IMAGE_HOMES = ("quay.io/ai-openshell", "ghcr.io/nvidia/openshell") +GATEWAY_IMAGE = "gateway" +SUPERVISOR_IMAGE = "supervisor" DIGEST_RE = re.compile(r"^sha256:[0-9a-f]{64}$") # How buildx words the registry's 404, the same test scripts/retag-image.sh @@ -84,13 +91,16 @@ def sdk_tags(self): return self._ls_remote_tags(SDK_REPO) def image_digest(self, repository, tag): - """'sha256:...' for repository:tag on ghcr.io, or None when the tag is not published. + """'sha256:...' for repository:tag, or None when the tag is not published. + + repository is the whole name, registry included + (`quay.io/ai-openshell/gateway`). Asked of the registry through buildx, which answers with the digest of the multi-arch index: the one `docker pull repo@sha256:...` resolves on any runner. It talks to the registry only; nothing is pulled or run. """ - reference = "%s/%s:%s" % (REGISTRY, repository, tag) + reference = "%s:%s" % (repository, tag) try: done = subprocess.run( ["docker", "buildx", "imagetools", "inspect", reference, "--format", "{{json .Manifest}}"],