From 825794a478e55cce56278fd779d56660e3f7a809 Mon Sep 17 00:00:00 2001 From: Ed Snible Date: Wed, 14 Oct 2026 09:12:30 -0400 Subject: [PATCH 1/2] feat: serve cortex installer at /cortex/install.sh sync-docs.sh now also copies rossoctl/cortex:scripts/install.sh to a git-ignored cortex/ directory (from CORTEX_SRC_REPO if set, else a sparse clone of CORTEX_REPO_URL). A postBuild plugin copies cortex/ into build/cortex/, so the script is served as a real file rather than the SPA's HTML fallback. A missing install.sh fails the sync, so the URL can't go live without the script. Refs rossoctl/cortex#1354 Assisted-By: Claude (Anthropic AI) Signed-off-by: Ed Snible --- .gitignore | 2 ++ docusaurus.config.ts | 10 ++++++++++ scripts/sync-docs.sh | 20 +++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7148526..5df584e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,10 @@ # committed here, regenerated on every build: # docs/ <- rossoctl/rossoctl:docs/ (Docs section) # contributing/index.md <- rossoctl/rossoctl:CONTRIBUTING.md (Contributing page) +# cortex/ <- rossoctl/cortex:scripts/install.sh (served at /cortex/install.sh) /docs /contributing/index.md +/cortex # --- Misc / editor --- .DS_Store diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 2396e2a..f7f49ba 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -203,6 +203,16 @@ const config: Config = { 'https://github.com/rossoctl/ecosystem-guide/tree/main/content/', }, ], + // Copies cortex/ (synced by scripts/sync-docs.sh) to build/cortex/, so + // /cortex/install.sh is served as a real file. `static/` can't be used: + // it's committed, and this file must not be. + () => ({ + name: 'cortex-installer', + postBuild: async ({outDir}) => + fs.cpSync(path.join(__dirname, 'cortex'), path.join(outDir, 'cortex'), { + recursive: true, + }), + }), ], // Enables Mermaid diagram rendering (paired with markdown.mermaid: true). diff --git a/scripts/sync-docs.sh b/scripts/sync-docs.sh index 0a3df3e..434b451 100755 --- a/scripts/sync-docs.sh +++ b/scripts/sync-docs.sh @@ -2,19 +2,23 @@ # sync-docs.sh — populate this site from the SOURCE OF TRUTH in rossoctl/rossoctl: # 1. docs/ -> the site's docs/ (rendered as the Docs section) # 2. CONTRIBUTING.md -> the site's contributing/index.md (Contributing page) +# and from rossoctl/cortex: +# 3. scripts/install.sh -> the site's cortex/install.sh (served at /cortex/install.sh) # -# Both destinations are git-ignored here and regenerated on every build (CI runs +# All destinations are git-ignored here and regenerated on every build (CI runs # this before `npm run build`; see .github/workflows/deploy.yaml). The canonical # content lives in rossoctl/rossoctl — edit it there, not here. # # Usage: # ./scripts/sync-docs.sh [git-ref] # clone from GitHub (default: main) # SRC_REPO=/path/to/local/rossoctl ./scripts/sync-docs.sh # use an existing local clone +# CORTEX_SRC_REPO=/path/to/local/cortex ./scripts/sync-docs.sh # likewise for cortex set -euo pipefail REF="${1:-main}" REPO_URL="https://github.com/rossoctl/rossoctl.git" # source of truth +CORTEX_REPO_URL="${CORTEX_REPO_URL:-https://github.com/rossoctl/cortex.git}" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SITE_DIR="$(dirname "$SCRIPT_DIR")" SUBDIR="docs" @@ -102,3 +106,17 @@ if [[ -f "$CONTRIB_SRC" ]]; then else echo "!! CONTRIBUTING.md not found at $CONTRIB_SRC (skipped Contributing page)." >&2 fi + +# --- 3. Cortex installer: copy scripts/install.sh -> cortex/install.sh ------- +# Fatal if missing: a published URL without the file would serve HTML to `sh`. +if [[ -n "${CORTEX_SRC_REPO:-}" ]]; then + CORTEX_SRC="$CORTEX_SRC_REPO" +else + CORTEX_SRC="$(mktemp -d)" + trap 'rm -rf "${TMP:-}" "$CORTEX_SRC"' EXIT + git clone --depth 1 --filter=blob:none --sparse "$CORTEX_REPO_URL" "$CORTEX_SRC" + git -C "$CORTEX_SRC" sparse-checkout set scripts +fi +mkdir -p "$SITE_DIR/cortex" +rsync -a "$CORTEX_SRC/scripts/install.sh" "$SITE_DIR/cortex/install.sh" +echo "==> cortex/install.sh copied from $CORTEX_SRC/scripts/install.sh." From bd8b5c43feae85dbfa13eb92a46c4578a8a59f92 Mon Sep 17 00:00:00 2001 From: Ed Snible Date: Wed, 14 Oct 2026 10:02:27 -0400 Subject: [PATCH 2/2] fix: log published cortex commit; update sync scope comments - Log the cortex commit that cortex/install.sh came from, so the deploy log records exactly what went live. - Don't pass rm an empty operand when TMP is unset. - Update comments in sync-docs.sh, deploy.yaml and netlify.toml that still described only the rossoctl/rossoctl sync. Refs rossoctl/cortex#1354 Assisted-By: Claude (Anthropic AI) Signed-off-by: Ed Snible --- .github/workflows/deploy.yaml | 6 +++--- netlify.toml | 4 ++-- scripts/sync-docs.sh | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e3afcf3..3ed0ae3 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -2,8 +2,8 @@ name: Deploy site to Pages # Builds the Docusaurus site and deploys it to GitHub Pages. # -# The Docs section is synced from rossoctl/rossoctl:docs/ at build time -# (npm run sync-docs). Triggers: +# The Docs section is synced from rossoctl/rossoctl:docs/, and /cortex/install.sh +# from rossoctl/cortex:scripts/install.sh, at build time (npm run sync-docs). Triggers: # - push to main (site source changed) # - repository_dispatch (docs changed upstream; sent by # rossoctl/rossoctl .github/workflows/docs-dispatch.yaml) @@ -43,7 +43,7 @@ jobs: - name: Install dependencies run: npm ci - - name: Sync docs from rossoctl/rossoctl:docs + - name: Sync docs from rossoctl/rossoctl and installer from rossoctl/cortex run: npm run sync-docs - name: Build diff --git a/netlify.toml b/netlify.toml index 79d76ca..0cbebc0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,7 +1,7 @@ # Netlify is used for PR deploy previews only. Production deploys go to GitHub # Pages via .github/workflows/deploy.yaml. The build syncs docs from -# rossoctl/rossoctl (a no-op while docs/ is absent / docs are hidden), then -# builds the Docusaurus site. Remove this file if the repo leaves Netlify. +# rossoctl/rossoctl and the installer from rossoctl/cortex, then builds the +# Docusaurus site. Remove this file if the repo leaves Netlify. [build] command = "npm run sync-docs && npm run build" publish = "build" diff --git a/scripts/sync-docs.sh b/scripts/sync-docs.sh index 434b451..7060f9c 100755 --- a/scripts/sync-docs.sh +++ b/scripts/sync-docs.sh @@ -7,7 +7,7 @@ # # All destinations are git-ignored here and regenerated on every build (CI runs # this before `npm run build`; see .github/workflows/deploy.yaml). The canonical -# content lives in rossoctl/rossoctl — edit it there, not here. +# content lives in those upstream repos — edit it there, not here. # # Usage: # ./scripts/sync-docs.sh [git-ref] # clone from GitHub (default: main) @@ -113,10 +113,10 @@ if [[ -n "${CORTEX_SRC_REPO:-}" ]]; then CORTEX_SRC="$CORTEX_SRC_REPO" else CORTEX_SRC="$(mktemp -d)" - trap 'rm -rf "${TMP:-}" "$CORTEX_SRC"' EXIT + trap 'rm -rf ${TMP:+"$TMP"} "$CORTEX_SRC"' EXIT git clone --depth 1 --filter=blob:none --sparse "$CORTEX_REPO_URL" "$CORTEX_SRC" git -C "$CORTEX_SRC" sparse-checkout set scripts fi mkdir -p "$SITE_DIR/cortex" rsync -a "$CORTEX_SRC/scripts/install.sh" "$SITE_DIR/cortex/install.sh" -echo "==> cortex/install.sh copied from $CORTEX_SRC/scripts/install.sh." +echo "==> cortex/install.sh copied from ${CORTEX_SRC_REPO:-$CORTEX_REPO_URL}@$(git -C "$CORTEX_SRC" rev-parse --short HEAD)."