Skip to content

Commit 5134034

Browse files
committed
ci(e2e): run the e2e gateway from the registry of each core release
Core releases since the move publish to quay.io/ai-openshell; older ones stay on ghcr.io/nvidia/openshell for good. Add core_registry, which finds the registry that holds a version, and use it to wait for the gateway image, to point core's deployment files at that registry, and to name the image in bump PRs. Refs ai-openshell/openshell#4554 Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent 575d68e commit 5134034

4 files changed

Lines changed: 41 additions & 12 deletions

File tree

‎scripts/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The workflows use a GitHub App token from the `sdk-bot` environment (secrets `SD
1717
| `update-drift-issue.sh <report.md> [--dry-run]` | `core:drift-issue` | Create, update, or close the single `Core main drift` issue from a report. |
1818
| `report-failure.sh <job> <run-url> [--dry-run]` | `core:report-failure` | Append a dated failure line to the drift issue. Called from `if: failure()` steps. |
1919
| `drift-issue.sh` | | Shared helpers for the two drift issue scripts (sourced, not run). |
20+
| `core-registry.sh` | | `core_registry <version>`: the registry that holds a core release's images, `quay.io/ai-openshell` for releases since the move and `ghcr.io/nvidia/openshell` for older ones. Sourced by `open-bump-pr.sh` and `e2e/start-gateway.sh`. |
2021

2122
| Workflow | Runs (mise tasks) |
2223
|----------|------|

‎scripts/core-sync/core-registry.sh‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# shellcheck shell=bash
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# core-registry.sh: sourced by e2e/start-gateway.sh and open-bump-pr.sh.
5+
#
6+
# core_registry <version> prints the registry that holds the core gateway
7+
# image <version> (X.Y.Z or X.Y.Z-pre.N), or fails when neither has it yet.
8+
# Releases since the move to Quay are on quay.io/ai-openshell; older ones stay
9+
# on ghcr.io/nvidia/openshell for good.
10+
core_registry() {
11+
local accept='Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.manifest.v1+json'
12+
local token
13+
if curl -fs -o /dev/null -H "$accept" "https://quay.io/v2/ai-openshell/gateway/manifests/$1"; then
14+
echo quay.io/ai-openshell
15+
return
16+
fi
17+
token=$(curl -fsS "https://ghcr.io/token?scope=repository:nvidia/openshell/gateway:pull" | jq -r .token) || return 1
18+
curl -fs -o /dev/null -H "Authorization: Bearer $token" -H "$accept" \
19+
"https://ghcr.io/v2/nvidia/openshell/gateway/manifests/$1" || return 1
20+
echo ghcr.io/nvidia/openshell
21+
}

‎scripts/core-sync/open-bump-pr.sh‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ set -euo pipefail
2525

2626
core_repo=${CORE_REPO:-NVIDIA/OpenShell}
2727
sdk_repo=${SDK_REPO:-ai-openshell/sdk-python}
28-
image=ghcr.io/nvidia/openshell/gateway
2928
diff_cap=400
3029

3130
tag=
@@ -167,8 +166,12 @@ fi
167166
generated=$(git diff --stat "$base" "$branch" -- src/openshell/_proto | tail -1 | sed "s/^ *//")
168167
fixtures=$(cat "$work/fixtures.txt")
169168

169+
# shellcheck source=scripts/core-sync/core-registry.sh
170+
. "$here/core-registry.sh"
171+
# A fresh tag's images may not be pushed yet; new releases go to Quay.
172+
registry=$(core_registry "${tag#v}") || registry=quay.io/ai-openshell
170173
body="$work/body.md"
171-
OLD="$old" NEW="$tag" KIND="$kind" COMPARE_URL="$compare_url" IMAGE="$image:${tag#v}" \
174+
OLD="$old" NEW="$tag" KIND="$kind" COMPARE_URL="$compare_url" IMAGE="$registry/gateway:${tag#v}" \
172175
GENERATED="${generated:-no generated files changed}" FIXTURES="${fixtures:- - none changed}" \
173176
PROTO_DIFF="$proto_section" \
174177
awk '{

‎scripts/e2e/start-gateway.sh‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
set -euo pipefail
2525

2626
core_repo=${CORE_REPO:-NVIDIA/OpenShell}
27-
registry=ghcr.io/nvidia/openshell
2827
name=e2e
2928
port=8080
3029
health_port=8081
@@ -49,27 +48,32 @@ mkdir -p "$state"
4948
echo "$tag" >"$state/core-version"
5049

5150
# Core pushes images after tagging; a proposal can be faster than that.
52-
manifest_exists() {
53-
local token
54-
token=$(curl -fsS "https://ghcr.io/token?scope=repository:nvidia/openshell/gateway:pull" | jq -r .token) || return 1
55-
curl -fsS -o /dev/null -H "Authorization: Bearer $token" \
56-
-H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.oci.image.manifest.v1+json' \
57-
"https://ghcr.io/v2/nvidia/openshell/gateway/manifests/$semver"
58-
}
51+
# shellcheck source=scripts/core-sync/core-registry.sh
52+
. "$(dirname "${BASH_SOURCE[0]}")/../core-sync/core-registry.sh"
5953
for i in $(seq 1 15); do
60-
manifest_exists && break
54+
registry=$(core_registry "$semver") && break
6155
if [ "$i" -eq 15 ]; then
6256
echo "ERROR: gateway image for $semver not published yet, re-run later" >&2
6357
exit 1
6458
fi
65-
echo "Waiting for $registry/gateway:$semver ($i/15) ..."
59+
echo "Waiting for the gateway image $semver ($i/15) ..."
6660
sleep 60
6761
done
6862

6963
# Core's deployment files at the tag.
7064
base="https://raw.githubusercontent.com/$core_repo/$tag/deploy/docker"
7165
curl -fsSL "$base/docker-compose.yml" -o "$state/docker-compose.yml"
7266
curl -fsSL "$base/gateway.toml" -o "$state/gateway.toml"
67+
# Use the registry that holds this version: tags cut shortly after the move
68+
# still name GHCR in their deployment files while their images are on Quay.
69+
for f in docker-compose.yml gateway.toml; do
70+
sed -E -i.bak "s#(ghcr\.io/nvidia/openshell|quay\.io/ai-openshell)/#$registry/#g" "$state/$f" &&
71+
rm -f "$state/$f.bak"
72+
done
73+
grep -q "$registry/gateway:" "$state/docker-compose.yml" || {
74+
echo "ERROR: core's docker-compose.yml at $tag does not use $registry/gateway" >&2
75+
exit 1
76+
}
7377
sed -i.bak \
7478
-e "s#\"$registry/supervisor:latest\"#\"$registry/supervisor:$semver\"#" \
7579
-e "s#\"$registry/sandbox:latest\"#\"$registry/sandbox:$semver\"#" \

0 commit comments

Comments
 (0)