diff --git a/Makefile b/Makefile index 4ce61a7..bb0b281 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,24 @@ -## OpenShell Harness — build and push images +## OpenShell Harness — build, push, and test ## ## Usage: -## make # build and push all images -## make sandbox # build + push sandbox image only -## make launcher # build + push launcher image only -## make gateway # build + push gateway + supervisor images -## make images # build all images (no push) -## make push # push all images +## make sandbox # build + push sandbox image (multi-arch) +## make launcher # build + push launcher image +## make test # build images + run full tests on both platforms +## make test-podman # build + test podman only +## make test-ocp # build + test OCP only REGISTRY ?= quay.io/rcochran/openshell -OPENSHELL_REPO ?= $(shell cd ../../nvidia/OpenShell 2>/dev/null && pwd || echo ../OpenShell) PLATFORM := linux/amd64 SANDBOX_IMAGE := $(REGISTRY):sandbox LAUNCHER_IMAGE := $(REGISTRY):launcher -GATEWAY_IMAGE := $(REGISTRY):gateway -SUPERVISOR_IMAGE := $(REGISTRY):supervisor -.PHONY: all images push sandbox launcher gateway supervisor \ - cli cli-gateway cli-supervisor cli-launcher \ +.PHONY: sandbox push-sandbox launcher push-launcher \ test test-podman test-ocp clean help -all: images push - ## ── Images ──────────────────────────────────────────────────────────── -images: sandbox launcher gateway supervisor - -push: push-sandbox push-launcher push-gateway push-supervisor - -## Sandbox image (Claude Code + mcp-atlassian + gws) +## Sandbox image (Claude Code + mcp-atlassian + gws, multi-arch) sandbox: sandbox/Dockerfile sandbox/startup.sh \ sandbox/policy.yaml sandbox/CLAUDE.md sandbox/settings.json docker buildx build --platform linux/amd64,linux/arm64 -t $(SANDBOX_IMAGE) sandbox/ --push @@ -38,7 +27,7 @@ sandbox: sandbox/Dockerfile sandbox/startup.sh \ push-sandbox: sandbox @echo "Already pushed by buildx" -## Launcher image (openshell CLI — requires cli-launcher first) +## Launcher image (openshell CLI for in-cluster sandbox creation) launcher: sandbox/launcher/Dockerfile sandbox/launcher/entrypoint.sh \ sandbox/launcher/openshell docker build --platform $(PLATFORM) -t $(LAUNCHER_IMAGE) sandbox/launcher/ @@ -47,83 +36,6 @@ launcher: sandbox/launcher/Dockerfile sandbox/launcher/entrypoint.sh \ push-launcher: launcher docker push $(LAUNCHER_IMAGE) -## Gateway image (requires cli-gateway first) -gateway: $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-gateway \ - $(OPENSHELL_REPO)/deploy/docker/Dockerfile.gateway - docker build --platform $(PLATFORM) \ - -t $(GATEWAY_IMAGE) \ - -f $(OPENSHELL_REPO)/deploy/docker/Dockerfile.gateway \ - $(OPENSHELL_REPO) - @echo "Built: $(GATEWAY_IMAGE)" - -push-gateway: gateway - docker push $(GATEWAY_IMAGE) - -## Supervisor image (requires cli-supervisor first) -supervisor: $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-sandbox \ - $(OPENSHELL_REPO)/deploy/docker/Dockerfile.supervisor - docker build --platform $(PLATFORM) \ - -t $(SUPERVISOR_IMAGE) \ - -f $(OPENSHELL_REPO)/deploy/docker/Dockerfile.supervisor \ - $(OPENSHELL_REPO) - @echo "Built: $(SUPERVISOR_IMAGE)" - -push-supervisor: supervisor - docker push $(SUPERVISOR_IMAGE) - -## ── CLI builds ──────────────────────────────────────────────────────── - -## Build the openshell CLI for the local machine (macOS arm64) -cli: - cd $(OPENSHELL_REPO) && cargo build --release -p openshell-cli - @echo "Built: $(OPENSHELL_REPO)/target/release/openshell" - -## Cross-compile the openshell CLI for linux/amd64 (launcher image) -cli-launcher: $(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell - cp $(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell \ - sandbox/launcher/openshell - @echo "Staged: sandbox/launcher/openshell" - -$(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell: - cd $(OPENSHELL_REPO) && cargo zigbuild --release \ - --target x86_64-unknown-linux-gnu \ - -p openshell-cli \ - --features openshell-prover/bundled-z3 - @echo "Cross-compiled: openshell CLI (linux/amd64)" - -## Cross-compile the gateway for linux/amd64 -cli-gateway: $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-gateway - -$(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-gateway: \ - $(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell-gateway - mkdir -p $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64 - cp $(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell-gateway \ - $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-gateway - @echo "Staged: gateway binary" - -$(OPENSHELL_REPO)/target/x86_64-unknown-linux-gnu/release/openshell-gateway: - cd $(OPENSHELL_REPO) && cargo zigbuild --release \ - --target x86_64-unknown-linux-gnu \ - -p openshell-server \ - --features bundled-z3 - @echo "Cross-compiled: openshell-gateway (linux/amd64)" - -## Cross-compile the supervisor for linux/amd64 (musl for scratch image) -cli-supervisor: $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-sandbox - -$(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-sandbox: \ - $(OPENSHELL_REPO)/target/x86_64-unknown-linux-musl/release/openshell-sandbox - mkdir -p $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64 - cp $(OPENSHELL_REPO)/target/x86_64-unknown-linux-musl/release/openshell-sandbox \ - $(OPENSHELL_REPO)/deploy/docker/.build/prebuilt-binaries/amd64/openshell-sandbox - @echo "Staged: supervisor binary" - -$(OPENSHELL_REPO)/target/x86_64-unknown-linux-musl/release/openshell-sandbox: - cd $(OPENSHELL_REPO) && cargo zigbuild --release \ - --target x86_64-unknown-linux-musl \ - -p openshell-sandbox - @echo "Cross-compiled: openshell-sandbox (linux/amd64 musl)" - ## ── Test targets ───────────────────────────────────────────────────── ## Build + push sandbox and launcher, then run full tests on both platforms @@ -140,10 +52,7 @@ test-ocp: sandbox push-launcher ## ── Convenience targets ─────────────────────────────────────────────── -## Build everything from source (slow — cross-compiles all binaries) -build-all: cli cli-launcher cli-gateway cli-supervisor images - -## Clean staged binaries (does not delete Docker images or Rust build cache) +## Clean staged binaries clean: rm -f sandbox/launcher/openshell @echo "Cleaned staged binaries" diff --git a/deploy-ocp.sh b/deploy-ocp.sh index eb0385f..9ac4673 100755 --- a/deploy-ocp.sh +++ b/deploy-ocp.sh @@ -1,17 +1,16 @@ #!/usr/bin/env bash # Deploy OpenShell to an OpenShift cluster using the official Helm chart. # +# Uses the OCI Helm chart from ghcr.io — no local OpenShell repo clone needed. +# # Usage: # ./deploy-ocp.sh # full deploy # ./deploy-ocp.sh --kubeconfig ./kubeconfig # explicit kubeconfig # # Environment variables (all optional, sensible defaults provided): -# OPENSHELL_REPO — path to NVIDIA/OpenShell checkout (default: ../OpenShell) -# GATEWAY_IMAGE_REPO — gateway image repo (default: quay.io/rcochran/openshell) -# GATEWAY_IMAGE_TAG — gateway image tag (default: gateway) -# SUPERVISOR_IMAGE_REPO — supervisor image repo (default: quay.io/rcochran/openshell) -# SANDBOX_IMAGE — sandbox image (default: quay.io/rcochran/openshell:sandbox) -# PULL_SECRET — imagePullSecrets name (default: none) +# OPENSHELL_CHART_VERSION — Helm chart version (default: from openshell.toml or 0.0.55) +# SANDBOX_IMAGE — sandbox image (default: quay.io/rcochran/openshell:sandbox) +# PULL_SECRET — imagePullSecrets name (default: none) # SANDBOX_PULL_SECRET — sandbox imagePullSecrets name (default: none) set -euo pipefail @@ -30,15 +29,20 @@ while [[ $# -gt 0 ]]; do esac done -OPENSHELL_REPO="${OPENSHELL_REPO:-$(cd "$SCRIPT_DIR/../../nvidia/OpenShell" 2>/dev/null && pwd || echo "$SCRIPT_DIR/../OpenShell")}" -if [[ ! -d "$OPENSHELL_REPO/deploy/helm/openshell" ]]; then - echo "ERROR: OpenShell repo not found at $OPENSHELL_REPO" - echo "Set OPENSHELL_REPO or clone NVIDIA/OpenShell alongside this repo" - exit 1 +# Read chart version from openshell.toml or env +CHART_VERSION="${OPENSHELL_CHART_VERSION:-}" +if [[ -z "$CHART_VERSION" && -f "$SCRIPT_DIR/openshell.toml" ]]; then + CHART_VERSION=$(python3 -c " +import tomllib +with open('$SCRIPT_DIR/openshell.toml', 'rb') as f: + print(tomllib.load(f).get('upstream', {}).get('chart-version', '')) +" 2>/dev/null || true) fi +CHART_VERSION="${CHART_VERSION:-0.0.55}" +CHART="oci://ghcr.io/nvidia/openshell/helm-chart" -echo "Using OpenShell repo: $OPENSHELL_REPO" -echo "Using KUBECONFIG: ${KUBECONFIG:-default}" +echo "OpenShell chart: $CHART_VERSION" +echo "KUBECONFIG: ${KUBECONFIG:-default}" echo "" # ── Step 1: Namespace ────────────────────────────────────────────────── @@ -51,7 +55,7 @@ kubectl label ns openshell \ # ── Step 2: Sandbox CRD + controller ────────────────────────────────── echo "=== Step 2: Installing Sandbox CRD ===" -kubectl apply -f "$OPENSHELL_REPO/deploy/kube/manifests/agent-sandbox.yaml" +kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/latest/download/manifest.yaml # ── Step 3: OpenShift SCCs ──────────────────────────────────────────── echo "=== Step 3: Granting OpenShift SCCs ===" @@ -99,13 +103,6 @@ RBAC # ── Step 4: Helm install gateway ────────────────────────────────────── echo "=== Step 4: Deploying gateway via Helm ===" -GATEWAY_IMAGE_REPO="${GATEWAY_IMAGE_REPO:-quay.io/rcochran/openshell}" -GATEWAY_IMAGE_TAG="${GATEWAY_IMAGE_TAG:-gateway}" -SUPERVISOR_IMAGE_REPO="${SUPERVISOR_IMAGE_REPO:-quay.io/rcochran/openshell}" -SUPERVISOR_IMAGE_TAG="${SUPERVISOR_IMAGE_TAG:-supervisor}" -echo " Gateway image: $GATEWAY_IMAGE_REPO:$GATEWAY_IMAGE_TAG" -echo " Supervisor image: $SUPERVISOR_IMAGE_REPO:$SUPERVISOR_IMAGE_TAG" - SANDBOX_IMAGE="${SANDBOX_IMAGE:-quay.io/rcochran/openshell:sandbox}" APPS_DOMAIN=$(kubectl get ingresses.config.openshift.io cluster -o jsonpath='{.spec.domain}' 2>/dev/null) @@ -117,10 +114,6 @@ ROUTE_HOST="gateway-openshell.${APPS_DOMAIN}" HELM_ARGS=( --values "$SCRIPT_DIR/values-ocp.yaml" - --set image.repository="$GATEWAY_IMAGE_REPO" - --set image.tag="$GATEWAY_IMAGE_TAG" - --set supervisor.image.repository="$SUPERVISOR_IMAGE_REPO" - --set supervisor.image.tag="$SUPERVISOR_IMAGE_TAG" --set server.sandboxImage="$SANDBOX_IMAGE" --set pkiInitJob.serverDnsNames[0]="$ROUTE_HOST" ) @@ -128,7 +121,7 @@ HELM_ARGS=( [[ -n "${PULL_SECRET:-}" ]] && HELM_ARGS+=(--set imagePullSecrets[0].name="$PULL_SECRET") [[ -n "${SANDBOX_PULL_SECRET:-}" ]] && HELM_ARGS+=(--set server.sandboxImagePullSecrets[0].name="$SANDBOX_PULL_SECRET") -helm upgrade --install openshell "$OPENSHELL_REPO/deploy/helm/openshell" -n openshell \ +helm upgrade --install openshell "$CHART" --version "$CHART_VERSION" -n openshell \ "${HELM_ARGS[@]}" echo "=== Waiting for gateway ===" @@ -162,12 +155,10 @@ GATEWAY_URL="https://${ROUTE_HOST}:443" CLI="${OPENSHELL_CLI:-openshell}" if command -v "$CLI" &>/dev/null; then - # Remove any old registration for this endpoint for gw in $("$CLI" gateway list 2>/dev/null | grep "$ROUTE_HOST" | awk '{gsub(/^\*/, ""); print $1}'); do "$CLI" gateway remove "$gw" 2>/dev/null || true done - # Register gateway (generates placeholder certs), then overwrite with real ones "$CLI" gateway add "$GATEWAY_URL" --name "$GATEWAY_NAME" --local 2>/dev/null || true MTLS_DIR="$HOME/.config/openshell/gateways/$GATEWAY_NAME/mtls" diff --git a/openshell.toml b/openshell.toml index 728e5ba..9f6a998 100644 --- a/openshell.toml +++ b/openshell.toml @@ -17,3 +17,6 @@ providers-custom = ["gws"] [inference] model = "claude-sonnet-4-6" + +[upstream] +chart-version = "0.0.55"