Public: anyone can read this; nobody can change it.

genesis: reseed r814 (automated #14) #250

Closed opened this view on origin
Closed without merging

reseed/r814 → main 2 commits

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
2 files changed +37 −26
bin/germinate +32 −25
@@ -477,18 +477,23 @@ _parse_repo_meta "$WORK/seed/manifest.yaml" 2>/dev/null || true
477477 # daughters with a private, unflagged template (mitosis#234/#236).
478478 is_public_repo(){ case "$1" in mitosis|ci-builder|ci-runner|app-template|_app-template) return 0 ;; *) return 1 ;; esac }
479479 is_template_repo(){ case "$1" in app-template|_app-template) return 0 ;; *) return 1 ;; esac }
480 mkrepo(){ local o=$1 n=$2 priv=true vis=private desc=""
481 is_public_repo "$n" && priv=false
482 # An org owner is created on first sight, with the admin as its Owner. The
483 # platform org is PUBLIC: a stranger must SEE the template to click "Use this
484 # template", and clone this repo to grow their own platform — a private org
485 # hides both (DEFAULT_ORG_VISIBILITY is private for every other org). Orgs
486 # riding in from a full-profile seed keep that default.
480 # mkorg — an org owner is created on first sight, with the admin as its Owner
481 # (the admin user itself is never an org). The platform org is PUBLIC: a
482 # stranger must SEE the template to click "Use this template", and clone this
483 # repo to grow their own platform — a private org hides both
484 # (DEFAULT_ORG_VISIBILITY is private for every other org). Orgs riding in from
485 # a full-profile seed keep that default. Idempotent: an existing org 422s.
486 mkorg(){ local o=$1 vis=private desc=""
487 [ "$o" = "$FORGEJO_USER" ] && return 0
487488 if [ "$o" = "$PLATFORM_OWNER" ]; then
488489 vis=public; desc="The platform's own org — gitops, the tool server, the crew, the app template and the seed live here."
489490 fi
490 [ "$o" != "$FORGEJO_USER" ] && curl -fsS -u "$FJA" -H 'Content-Type: application/json' \
491 curl -fsS -u "$FJA" -H 'Content-Type: application/json' \
491492 -d "$(jq -n --arg u "$o" --arg v "$vis" --arg d "$desc" '{username:$u, visibility:$v, description:$d}')" "$FJ/api/v1/orgs" >/dev/null 2>&1||true
493 }
494 mkrepo(){ local o=$1 n=$2 priv=true
495 is_public_repo "$n" && priv=false
496 mkorg "$o"
492497 curl -fsS -u "$FJA" -H 'Content-Type: application/json' -d "{\"name\":\"$n\",\"default_branch\":\"$FLUX_BRANCH\",\"private\":$priv}" \
493498 "$FJ/api/v1/$( [ "$o" = "$FORGEJO_USER" ] && echo user/repos || echo orgs/$o/repos )" >/dev/null 2>&1||true
494499 # A repo's `private` flag is also a SETTING (a re-push won't change it), so PATCH
@@ -656,19 +661,6 @@ if [ -f "$WORK/seed/upstream.pub" ]; then
656661 echo " WARN: seed upstream.pub sha mismatch — upstream propagation NOT armed"
657662 fi
658663 fi
659 # Flux push-webhook on the platform gitops → instant central reconciles
660 # (best-effort: absence degrades to interval polling; org-repo webhooks are
661 # MCP's job). The path derives from the receiver token exactly as
662 # notification-controller does (the Receiver is named plat-gitops).
663 if [ -n "${FLUX_RECEIVER_TOKEN:-}" ]; then
664 _nd=$(printf '%s%s%s' "$FLUX_RECEIVER_TOKEN" "plat-gitops" "flux-system" | { sha256sum 2>/dev/null || shasum -a 256; } | cut -d' ' -f1)
665 curl -fsS -m 15 -X POST "$FJ/api/v1/repos/$PLATFORM_OWNER/gitops/hooks" \
666 -H "Authorization: token $DPAT" -H 'Content-Type: application/json' \
667 -d "{\"type\":\"forgejo\",\"active\":true,\"events\":[\"push\"],\"branch_filter\":\"main\",\"config\":{\"url\":\"http://webhook-receiver.flux-system.svc.cluster.local/hook/$_nd\",\"content_type\":\"json\",\"secret\":\"$FLUX_RECEIVER_TOKEN\"}}" \
668 >/dev/null 2>&1 \
669 && echo " flux push-webhook registered on $PLATFORM_OWNER/gitops" \
670 || echo " WARN: flux push-webhook registration failed (non-fatal — interval polling covers it)"
671 fi
672664 if fork_register_oauth "$GITOPS_DIR" "$FJ" "$FJA" "$DOMAIN"; then
673665 echo " plat-mcp OAuth app registered on the daughter"
674666 else
@@ -742,10 +734,9 @@ try_migrate_mitosis(){ # $1=tier $2=source URL (no .git) — 0 iff the repo migr
742734 }
743735 if [ -d "$WORK/r-mitosis" ]; then
744736 curl -fsS -m5 "$FJ/api/v1/version" >/dev/null 2>&1 || fj_pf || true
745 # The migrate target owner must exist first (mkrepo normally creates the org
746 # in the re-push loop, which runs after us). mkrepo's org branch is exactly
747 # that create — public + described when it is the platform org.
748 [ "$MITOSIS_OWNER" != "$FORGEJO_USER" ] && mkrepo "$MITOSIS_OWNER" "" 2>/dev/null || true
737 # The migrate target owner must exist first (the re-push loop, which runs
738 # after us, creates it for every other repo).
739 mkorg "$MITOSIS_OWNER"
749740 # The parent's mitosis lives under the parent's owner — the same owner the
750741 # seed recorded for the bundle.
751742 T1_SRC=""; [ -n "$CREATED_FROM" ] && T1_SRC="${CREATED_FROM%/}/$MITOSIS_OWNER/mitosis"
@@ -825,6 +816,22 @@ for r in "${REPONAMES[@]}"; do
825816 protect_workflows "$FJ" "$FJA" "$o" "$n"
826817 done
827818
819 STEP="register the flux push-webhook on the platform gitops"
820 # Flux push-webhook on the platform gitops → instant central reconciles
821 # (best-effort: absence degrades to interval polling; org-repo webhooks are
822 # MCP's job). The path derives from the receiver token exactly as
823 # notification-controller does (the Receiver is named plat-gitops). Registered
824 # AFTER the re-push: only then does the repo exist in the real forge.
825 if [ -n "${FLUX_RECEIVER_TOKEN:-}" ]; then
826 _nd=$(printf '%s%s%s' "$FLUX_RECEIVER_TOKEN" "plat-gitops" "flux-system" | { sha256sum 2>/dev/null || shasum -a 256; } | cut -d' ' -f1)
827 curl -fsS -m 15 -X POST "$FJ/api/v1/repos/$PLATFORM_OWNER/gitops/hooks" \
828 -H "Authorization: token $DPAT" -H 'Content-Type: application/json' \
829 -d "{\"type\":\"forgejo\",\"active\":true,\"events\":[\"push\"],\"branch_filter\":\"main\",\"config\":{\"url\":\"http://webhook-receiver.flux-system.svc.cluster.local/hook/$_nd\",\"content_type\":\"json\",\"secret\":\"$FLUX_RECEIVER_TOKEN\"}}" \
830 >/dev/null 2>&1 \
831 && echo " flux push-webhook registered on $PLATFORM_OWNER/gitops" \
832 || echo " WARN: flux push-webhook registration failed (non-fatal — interval polling covers it)"
833 fi
834
828835 # The app template repo MUST be a Forgejo *template* repo or create_app 422s and
829836 # the daughter can't build apps at all — the front door dies with it 25 minutes
830837 # later (mitosis#234). mkrepo flags it best-effort BEFORE the push (when the repo
scripts/coldstart-assert.sh +5 −1
@@ -151,7 +151,11 @@ PF_PID=""
151151 # its gitops is the CENTRAL tree, else the admin user (a platform born before
152152 # the org). Probe the activation list, not the repo: a legacy daughter's
153153 # front-door org owns a tenant ground of the same name (apps/ at its root).
154 platform_owner() { # $1=admin user $2=admin pw (needs the port-forward)
154 platform_owner() { # $1=admin user $2=admin pw (starts the port-forward if needed)
155 # Without a live port-forward the probe curl fails and the fallback answers
156 # the admin user — which sent A7/A8 to plat/mitosis on an org-shaped
157 # daughter (gate #250, run 28089). Never probe through a dead tunnel.
158 [ -n "$PF_PORT" ] || start_portforward
155159 if curl -fsS -o /dev/null -u "$1:$2" "http://127.0.0.1:${PF_PORT}/api/v1/repos/${PLATFORM_ORG:-open-platform}/gitops/raw/clusters/local/apps/kustomization.yaml" 2>/dev/null; then
156160 echo "${PLATFORM_ORG:-open-platform}"
157161 else

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs