Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hack/automation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Workflows run them with a token of the `ai-openshell-sdk-go` GitHub App (`ai-ope
| `core-tags.sh` | `core:tags` | List NVIDIA/OpenShell release tags newer than the pin (`buf.gen.yaml`, `inputs[0].tag`), semver-sorted with pre-releases below their stable version. |
| `open-bump-pr.sh <tag> [--dry-run]` | `core:bump` | Open the update proposal for one core tag: branch `core/<tag>`, pin change, regenerated bindings, proto diff in the body, labels `core-bump` plus `stable` or `prerelease`. Closes older pre-release proposals. |
| `bump-pr-body.md` | | PR body template for `open-bump-pr.sh`. |
| `core-registry.sh` | | Sourced by `start-gateway.sh` and `open-bump-pr.sh`: `core_registry <version>` prints 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. |
| `tag-release.sh [--dry-run]` | `release:tag` | After a stable pin lands on `main`: create the lockstep tag `vX.Y.Z` and the GitHub release, then ask the Go module proxy for the version. |
| `drift-check.sh --out <file>` | `core:drift` | Compare core `main` against the pin: `buf breaking`, regenerate and build, uncovered RPCs. Writes the markdown report. |
| `update-drift-issue.sh <report.md>` | | Create, update, or close the single `Core main drift` issue from a report. |
Expand Down
21 changes: 21 additions & 0 deletions hack/automation/core-registry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# shellcheck shell=bash
# SPDX-License-Identifier: Apache-2.0

# core-registry.sh: sourced by start-gateway.sh and open-bump-pr.sh.
#
# core_registry <version> prints the registry that holds the core gateway
# image <version> (X.Y.Z or X.Y.Z-pre.N), or fails when neither has it yet.
# Releases since the move to Quay are on quay.io/ai-openshell; older ones stay
# on ghcr.io/nvidia/openshell for good.
core_registry() {
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'
local token
if curl -fs -o /dev/null -H "$accept" "https://quay.io/v2/ai-openshell/gateway/manifests/$1"; then
echo quay.io/ai-openshell
return
fi
token=$(curl -fsS "https://ghcr.io/token?scope=repository:nvidia/openshell/gateway:pull" | jq -r .token) || return 1
curl -fs -o /dev/null -H "Authorization: Bearer $token" -H "$accept" \
"https://ghcr.io/v2/nvidia/openshell/gateway/manifests/$1" || return 1
echo ghcr.io/nvidia/openshell
}
7 changes: 5 additions & 2 deletions hack/automation/open-bump-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ set -euo pipefail

core_repo=${CORE_REPO:-NVIDIA/OpenShell}
sdk_repo=${SDK_REPO:-ai-openshell/sdk-go}
image=ghcr.io/nvidia/openshell/gateway
diff_cap=400

tag=
Expand Down Expand Up @@ -160,8 +159,12 @@ fi
generated=$(git diff --stat "$base" "$branch" -- proto/ | tail -1 | sed "s/^ *//")
fixtures=$(cat "$work/fixtures.txt")

# shellcheck source=hack/automation/core-registry.sh
. "$here/core-registry.sh"
# A fresh tag's images may not be pushed yet; new releases go to Quay.
registry=$(core_registry "${tag#v}") || registry=quay.io/ai-openshell
body="$work/body.md"
OLD="$old" NEW="$tag" KIND="$kind" COMPARE_URL="$compare_url" IMAGE="$image:${tag#v}" \
OLD="$old" NEW="$tag" KIND="$kind" COMPARE_URL="$compare_url" IMAGE="$registry/gateway:${tag#v}" \
GENERATED="${generated:-no generated files changed}" FIXTURES="${fixtures:-- no fixture changes}" \
PROTO_DIFF="$proto_section" \
awk '{
Expand Down
24 changes: 14 additions & 10 deletions hack/automation/start-gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
set -euo pipefail

core_repo=${CORE_REPO:-NVIDIA/OpenShell}
registry=ghcr.io/nvidia/openshell
name=e2e
port=8080
health_port=8081
Expand All @@ -45,27 +44,32 @@ mkdir -p "$state"
echo "$tag" >"$state/core-version"

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

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