Skip to content

Commit 3318de5

Browse files
committed
docs(sandbox): auto-clone the kagenti-extensions plugin in 01-build-images.sh
Drop the manual "check out kagenti-extensions" prerequisite. When EXT_DIR is unset, the script now clones the placeholder-resolve plugin itself from EXT_REPO @ EXT_REF (default huang195/kagenti-extensions @ feat/placeholder-resolve-plugin; switch to canonical main once PR NVIDIA#626 merges). EXT_DIR still wins for a local checkout. The supervisor side needs no checkout step — it builds from this OpenShell repo (you're already on feat/authbridge-egress). - 01-build-images.sh: EXT_DIR optional; add EXT_REPO/EXT_REF; clone-or-reuse before the build; fail-fast message points at EXT_REPO/EXT_REF. - README + guide: prereq #2 is just the OpenShell branch; the plugin is cloned for you; drop the EXT_DIR export from the quick-start; document EXT_REPO/EXT_REF. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Hai Huang <huang195@gmail.com>
1 parent 002b649 commit 3318de5

3 files changed

Lines changed: 53 additions & 26 deletions

File tree

docs/sandboxes/authbridge-egress.mdx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ internal proxy to the AuthBridge sidecar.
8888
**[Kagenti Sandbox Guide](https://github.com/kagenti/kagenti/blob/main/docs/sandbox-guide.md)**
8989
(Kind cluster, shared infra, a tenant gateway, the CLI configured and logged in).
9090
This guide assumes you can already create a normal sandbox in `team1`.
91-
- **Check out the feature branches this integration depends on (both unmerged):** this
92-
OpenShell repo on **`feat/authbridge-egress`** (`NetworkMode::External`), and a
93-
kagenti-extensions checkout on **`feat/placeholder-resolve-plugin`** (the plugin). See
94-
*Where the images come from* below; `01-build-images.sh` fails fast if either checkout
95-
is missing its feature.
91+
- **This OpenShell repo on the `feat/authbridge-egress` branch** (`NetworkMode::External`) —
92+
you're already on it if you're reading this, and the supervisor is built from it. The
93+
kagenti-extensions **`placeholder-resolve`** plugin is **cloned automatically** by
94+
`01-build-images.sh` (from `huang195/kagenti-extensions @ feat/placeholder-resolve-plugin`
95+
by default; override with `EXT_REPO`/`EXT_REF`, or set `EXT_DIR` to a local checkout). See
96+
*Where the images come from* below; the script fails fast if the resolved source lacks the plugin.
9697
- `kubectl`, `jq`, `openssl`, and `podman` (or Docker) on your machine.
9798
- An LLM endpoint that accepts `Authorization: Bearer <token>` (e.g. a LiteLLM
9899
proxy) and the corresponding token.
@@ -102,9 +103,9 @@ endpoint exported once:
102103

103104
```bash
104105
cd examples/authbridge-egress
105-
export EXT_DIR=~/src/kagenti-extensions # kagenti-extensions @ feat/placeholder-resolve-plugin
106106
export KAGENTI_DIR=~/src/kagenti # kagenti repo (lets Step 1 redeploy the gateway)
107107
export LLM_URL=https://your-litellm.example.com
108+
# kagenti-extensions is cloned for you; set EXT_DIR=~/src/kagenti-extensions to reuse a local checkout
108109
```
109110

110111
The tenant namespace is `team1` and the kind cluster is `kagenti`. Override with the
@@ -122,15 +123,17 @@ merged to mainline**, so the images are built from local checkouts of those bran
122123
| authbridge-proxy (built here) | kagenti-extensions `feat/placeholder-resolve-plugin` (`ca8cbd8`) | `placeholder-resolve` + `inference-parser` (Anthropic) + the SSE-relay fix + the session API — all stacked on this branch |
123124
| gateway (prebuilt, pulled) | image tag `mvp-v2-7784be8` (commit `7784be8`, the base of `feat/authbridge-egress`) | the `inference-scoped-provider-lookup` fix — **not** in the chart default `v0.0.56-rc.3` |
124125

125-
Until these branches are merged (or tagged), reproducing the demo means checking them
126-
out at (or after) the commits above and pinning the gateway tag as shown in Step 1.
126+
Until these branches are merged (or tagged), the supervisor is built from this OpenShell
127+
checkout and the plugin is cloned from `EXT_REPO`/`EXT_REF` (Step 1), with the gateway tag
128+
pinned as shown.
127129

128130
## Step 1: Build and load the images
129131

130132
[`01-build-images.sh`](https://github.com/kagenti/OpenShell/tree/feat/authbridge-egress/examples/authbridge-egress)
131-
compiles the External-capable supervisor binary in a `rust:1.95` builder container,
132-
wraps it in a `scratch` image, builds the AuthBridge proxy image, loads both into kind,
133-
and — when `KAGENTI_DIR` is set — redeploys the `team1` gateway for you:
133+
clones the kagenti-extensions `placeholder-resolve` plugin (unless `EXT_DIR` points at a
134+
local checkout), compiles the External-capable supervisor binary in a `rust:1.95` builder
135+
container, wraps it in a `scratch` image, builds the AuthBridge proxy image, loads both into
136+
kind, and — when `KAGENTI_DIR` is set — redeploys the `team1` gateway for you:
134137

135138
```bash
136139
./01-build-images.sh # uses $EXT_DIR; with $KAGENTI_DIR set, also redeploys the gateway

examples/authbridge-egress/01-build-images.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
# load both into the kind cluster, and (optionally) point the tenant gateway at
77
# them with the gateway tag correctly pinned.
88
#
9-
# Env knobs (all optional except EXT_DIR):
10-
# EXT_DIR kagenti-extensions checkout (feat/placeholder-resolve-plugin) [required]
9+
# Env knobs (all optional):
10+
# EXT_DIR Local kagenti-extensions checkout (feat/placeholder-resolve-plugin).
11+
# Used as-is if set; if unset, the script clones EXT_REPO @ EXT_REF.
12+
# EXT_REPO Repo to clone the plugin from when EXT_DIR is unset
13+
# (default: https://github.com/huang195/kagenti-extensions; switch to
14+
# https://github.com/kagenti/kagenti-extensions once PR #626 merges).
15+
# EXT_REF Branch/ref to clone (default: feat/placeholder-resolve-plugin; 'main' post-merge).
1116
# KAGENTI_DIR kagenti repo checkout. If set, this script also runs
1217
# deploy-tenant.sh to redeploy the gateway with the new
1318
# supervisor image and the pinned gateway tag. If unset, it
@@ -24,7 +29,9 @@ set -euo pipefail
2429

2530
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2631
OPENSHELL_DIR="${OPENSHELL_DIR:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
27-
EXT_DIR="${EXT_DIR:?set EXT_DIR to your kagenti-extensions checkout (feat/placeholder-resolve-plugin)}"
32+
EXT_DIR="${EXT_DIR:-}"
33+
EXT_REPO="${EXT_REPO:-https://github.com/huang195/kagenti-extensions}"
34+
EXT_REF="${EXT_REF:-feat/placeholder-resolve-plugin}"
2835
ARCH="${ARCH:-arm64}"
2936
CLUSTER="${CLUSTER:-kagenti}"
3037
NS="${NS:-team1}"
@@ -38,6 +45,21 @@ case "$ARCH" in
3845
*) echo "unsupported ARCH '$ARCH' (use arm64 or amd64)" >&2; exit 1 ;;
3946
esac
4047

48+
mkdir -p "$OUT"
49+
50+
# Resolve the kagenti-extensions source for the AuthBridge image: use EXT_DIR if
51+
# given, otherwise clone EXT_REPO @ EXT_REF (the plugin is on an unmerged branch).
52+
if [ -z "$EXT_DIR" ]; then
53+
EXT_DIR="$OUT/kagenti-extensions"
54+
if [ -d "$EXT_DIR/.git" ]; then
55+
echo "==> Updating $EXT_DIR ($EXT_REF from $EXT_REPO)..."
56+
git -C "$EXT_DIR" fetch --depth 1 "$EXT_REPO" "$EXT_REF" && git -C "$EXT_DIR" checkout -f FETCH_HEAD
57+
else
58+
echo "==> Cloning $EXT_REPO ($EXT_REF) -> $EXT_DIR..."
59+
git clone --depth 1 --branch "$EXT_REF" "$EXT_REPO" "$EXT_DIR"
60+
fi
61+
fi
62+
4163
# The supporting commits are NOT merged to mainline — fail fast if the checkouts
4264
# don't actually contain them, rather than silently building feature-less images.
4365
if ! grep -rqs "OPENSHELL_EXTERNAL_PROXY" "$OPENSHELL_DIR/crates/openshell-sandbox/src/"; then
@@ -47,12 +69,10 @@ if ! grep -rqs "OPENSHELL_EXTERNAL_PROXY" "$OPENSHELL_DIR/crates/openshell-sandb
4769
fi
4870
if [ ! -d "$EXT_DIR/authbridge/authlib/plugins/placeholderresolve" ]; then
4971
echo "ERROR: $EXT_DIR has no placeholder-resolve plugin." >&2
50-
echo " Check out the kagenti-extensions 'feat/placeholder-resolve-plugin' branch, or set EXT_DIR." >&2
72+
echo " Check EXT_REPO/EXT_REF, or point EXT_DIR at a checkout that has it." >&2
5173
exit 1
5274
fi
5375

54-
mkdir -p "$OUT"
55-
5676
echo "==> [1/4] Compiling the supervisor binary ($RUST_TARGET) in a builder container..."
5777
podman run --rm \
5878
-v "$OPENSHELL_DIR":/src:ro -w /src \

examples/authbridge-egress/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,25 @@ Full walkthrough and concepts: **[docs/sandboxes/authbridge-egress.mdx](../../do
3030

3131
1. A working OpenShell install with a `team1` tenant gateway, per the
3232
[Kagenti Sandbox Guide](https://github.com/kagenti/kagenti/blob/main/docs/sandbox-guide.md).
33-
2. **Check out the unmerged feature branches this integration depends on:**
34-
- this repo (OpenShell) on **`feat/authbridge-egress`** (adds `NetworkMode::External`);
35-
- a [kagenti-extensions](https://github.com/kagenti/kagenti-extensions) checkout on
36-
**`feat/placeholder-resolve-plugin`** (the `placeholder-resolve` plugin).
37-
38-
`01-build-images.sh` fails fast if a checkout is missing its feature.
33+
2. **This OpenShell repo on the `feat/authbridge-egress` branch** (adds
34+
`NetworkMode::External`) — you're already on it if you're reading this, and the
35+
supervisor image is built from it.
36+
37+
The kagenti-extensions **`placeholder-resolve`** plugin is **cloned automatically** by
38+
`01-build-images.sh` (from `huang195/kagenti-extensions @ feat/placeholder-resolve-plugin`
39+
by default — override with `EXT_REPO`/`EXT_REF`, or set `EXT_DIR` to a local checkout).
40+
The script fails fast if the resolved source is missing the plugin.
3941
3. `kubectl`, `jq`, `openssl`, and `podman` (or Docker).
4042

4143
## Quick start
4244

4345
```bash
4446
cd examples/authbridge-egress
4547

46-
# Set these once: your checkouts + your upstream LLM endpoint.
47-
export EXT_DIR=~/src/kagenti-extensions # kagenti-extensions @ feat/placeholder-resolve-plugin
48+
# Set these once: your kagenti checkout + your upstream LLM endpoint.
4849
export KAGENTI_DIR=~/src/kagenti # kagenti repo (lets step 1 redeploy the gateway)
4950
export LLM_URL=https://your-litellm.example.com
51+
# kagenti-extensions is cloned for you; set EXT_DIR=~/src/kagenti-extensions to reuse a local checkout
5052

5153
# 1. Build + load both images AND redeploy the team1 gateway (gateway tag auto-pinned),
5254
# then log back in (the gateway restart expires your CLI token).
@@ -76,7 +78,9 @@ SANDBOX=<sandbox-name>
7678

7779
| Var | Default | Used by |
7880
|-----|---------|---------|
79-
| `EXT_DIR` | _(required)_ | 01 |
81+
| `EXT_DIR` | _(optional — local kagenti-extensions checkout; else auto-cloned)_ | 01 |
82+
| `EXT_REPO` | `https://github.com/huang195/kagenti-extensions` | 01 |
83+
| `EXT_REF` | `feat/placeholder-resolve-plugin` | 01 |
8084
| `KAGENTI_DIR` | _(optional — if set, 01 auto-redeploys the gateway)_ | 01 |
8185
| `NS` | `team1` | 01, 02, 03, 04 |
8286
| `CLUSTER` | `kagenti` | 01 |

0 commit comments

Comments
 (0)