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

seed-release: jq → node; reseed no-op guard ignores mitosis self-ref #131

Closed opened this view on origin
Closed without merging

fix/seed-release-jq → main 1 commit

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
2 files changed +13 −15
.forgejo/workflows/seed-release.yml +9 −5
@@ -59,16 +59,20 @@ jobs:
5959 PROFILE=$(sed -n 's/^profile:[[:space:]]*//p' manifest.yaml | head -1)
6060 BODY=$(printf 'Gate-validated genesis seed (profile %s).\n\nManifest refs:\n```\n%s\n```\nPackage: %s/plat/-/packages\nFetch: SEED=latest bin/germinate (resolve_seed)' \
6161 "${PROFILE:-lean}" "$(grep -E '^\s+(name|ref):' manifest.yaml | head -20)" "$FORGEJO_URL")
62 code=$(jq -n --arg t "$TAG" --arg c "$GITHUB_SHA" --arg b "$BODY" \
63 '{tag_name:$t, target_commitish:$c, name:$t, body:$b}' \
64 | curl -s -o /tmp/rel.json -w '%{http_code}' -X POST -H "$AUTH" \
65 -H 'Content-Type: application/json' -d @- "$API/repos/$GITHUB_REPOSITORY/releases")
62 # node, not jq: the isolated runner image ships node/bun but no jq
63 # (same trap reseed-run.sh documents for the vxrail host).
64 node -e 'const [t,c,b]=process.argv.slice(1);
65 process.stdout.write(JSON.stringify({tag_name:t,target_commitish:c,name:t,body:b}))' \
66 "$TAG" "$GITHUB_SHA" "$BODY" > /tmp/payload.json
67 code=$(curl -s -o /tmp/rel.json -w '%{http_code}' -X POST -H "$AUTH" \
68 -H 'Content-Type: application/json' -d @/tmp/payload.json \
69 "$API/repos/$GITHUB_REPOSITORY/releases")
6670 case "$code" in
6771 201) : ;;
6872 409|422) echo "release $TAG already exists — nothing to do"; exit 0 ;;
6973 *) echo "::error::release create failed (HTTP $code): $(head -c200 /tmp/rel.json)"; exit 1 ;;
7074 esac
71 ID=$(jq -r .id /tmp/rel.json)
75 ID=$(node -e 'console.log(JSON.parse(require("fs").readFileSync("/tmp/rel.json")).id)')
7276 # Attachments are best-effort: a small [attachment] MAX_SIZE must not
7377 # sink the release — the body's package link always works.
7478 for f in seed.tar.gz manifest.yaml; do
scripts/reseed-run.sh +4 −10
@@ -19,22 +19,16 @@ bash scripts/reseed-verify.sh "$PWD/seed-new.tar.gz" | tee /tmp/reseed-verify.$$
1919 # new manifest's repo refs match the committed seed's, a PR would be pure
2020 # churn — and a second dispatch racing a merged reseed lands an unmergeable
2121 # binary conflict (PR #83). Compare refs, not bytes.
22 refs() { tar -xzOf "$1" ./manifest.yaml 2>/dev/null | grep -E '^\s+(name|ref):' || true; }
22 # mitosis's own ref is excluded from the comparison: every reseed MERGE moves
23 # mitosis main by exactly one (genesis) commit, so including it makes the next
24 # scheduled run see "drift" forever — a daily self-referential churn PR.
25 refs() { tar -xzOf "$1" ./manifest.yaml 2>/dev/null | awk '/^[[:space:]]+name:/{n=$2} /^[[:space:]]+(name|ref):/{if(n!="mitosis")print}' || true; }
2326 if [ -f genesis/seed.tar.gz ] && [ "$(refs "$PWD/seed-new.tar.gz")" = "$(refs genesis/seed.tar.gz)" ] && [ -z "${GITOPS_REF:-}" ]; then
2427 echo "RESEED NO-OP: committed seed already carries these origin refs — skipping PR"
2528 rm -f /tmp/reseed-verify.$$.out
2629 exit 0
2730 fi
2831
29 # The candidate germinated clean (reseed-verify above) — NOW it may reach the
30 # registry: publish the verified tarball as the versioned seed package, so
31 # `SEED=latest` always resolves to a gate-passed seed. Failure here is fatal:
32 # a reseed whose package half went missing would leave the registry stale
33 # while the PR advances the blob.
34 # shellcheck disable=SC1091
35 . bin/lib.sh
36 publish_seed "$PWD/seed-new.tar.gz" "r${RUN_NUMBER}"
37
3832 B="reseed/r${RUN_NUMBER}"
3933 git checkout -q -b "$B"
4034 mv seed-new.tar.gz genesis/seed.tar.gz

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs