From cfac32736efe667773097fb0290b809c4085a9a5 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Tue, 11 Aug 2026 06:21:38 +0000 Subject: [PATCH] zero-gravity: resolve release tag by probing known forms; fail loudly on 404 0G publishes aristotle and galileo from two different repos, and neither uses a consistent release-tag format. The asset filename is always -v.tar.gz; only the tag varies: aristotle -> 0gchain-Aristotle 1.0.4 = "1.0.4" 1.0.6 = "v1.0.6" galileo -> 0gchain-NG 3.0.3 = "v3.0.3" 3.0.7 = "galileo-v3.0.7" 3.0.8 = "v3.0.8" The hardcoded formats meant aristotle could not go past 1.0.4 and galileo could not reach 3.0.7. Resolve the tag by trying the known forms in order instead. Also switch curl -sL to -fsSL. Without -f a 404 HTML body was written into the .tar.gz and the build failed several layers later at 'tar: not in gzip format', an error pointing nowhere near the cause. That has now caused three separate misdiagnoses, including a de-32 build blocker. Verified end-to-end against the real artifacts: aristotle 1.0.4/1.0.6 and galileo 3.0.3/3.0.7/3.0.8 all resolve; aristotle 3.0.3 and galileo 9.9.9 fail immediately with an actionable message. Co-Authored-By: Claude Opus 5 (1M context) --- zero-gravity/zerog.Dockerfile | 43 +++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/zero-gravity/zerog.Dockerfile b/zero-gravity/zerog.Dockerfile index 152a9016..7c2b1422 100644 --- a/zero-gravity/zerog.Dockerfile +++ b/zero-gravity/zerog.Dockerfile @@ -8,11 +8,46 @@ RUN chmod +x /usr/local/bin/init.sh ARG ZERO_GRAVITY_VERSION ARG ZERO_GRAVITY_CHAIN_SPEC -RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "aristotle" ]; then \ - curl -sL https://github.com/0gfoundation/0gchain-Aristotle/releases/download/${ZERO_GRAVITY_VERSION}/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -o /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz; \ + +# 0G publishes each network from a DIFFERENT repository, and the release-tag format is not +# consistent within either of them. The asset filename is always "-v.tar.gz"; +# only the tag varies: +# +# aristotle -> 0gchain-Aristotle 1.0.4 = "1.0.4" 1.0.6 = "v1.0.6" +# galileo -> 0gchain-NG 3.0.3 = "v3.0.3" 3.0.7 = "galileo-v3.0.7" 3.0.8 = "v3.0.8" +# +# So the tag cannot be hardcoded. Resolve it by trying the known forms in order and taking +# the first that actually yields the asset. +# +# curl uses -f (fail on HTTP error). Without it a 404 HTML body is written into the .tar.gz +# and the build dies several layers later at "tar: not in gzip format" -- an error that +# points nowhere near the real cause. That has cost three separate misdiagnoses. +RUN set -eu; \ + ASSET="${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz"; \ + if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "aristotle" ]; then \ + REPO="0gfoundation/0gchain-Aristotle"; \ + TAGS="${ZERO_GRAVITY_VERSION} v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \ else \ - curl -sL https://github.com/0gfoundation/0gchain-NG/releases/download/v${ZERO_GRAVITY_VERSION}/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -o /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz; \ + REPO="0gfoundation/0gchain-NG"; \ + TAGS="v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_VERSION}"; \ + fi; \ + for TAG in ${TAGS}; do \ + URL="https://github.com/${REPO}/releases/download/${TAG}/${ASSET}"; \ + echo "0g: trying tag '${TAG}' -> ${URL}"; \ + if curl -fsSL "${URL}" -o "/tmp/${ASSET}"; then \ + echo "0g: resolved ${ZERO_GRAVITY_CHAIN_SPEC} ${ZERO_GRAVITY_VERSION} from tag '${TAG}'"; \ + break; \ + fi; \ + rm -f "/tmp/${ASSET}"; \ + done; \ + if [ ! -s "/tmp/${ASSET}" ]; then \ + echo "0g: FATAL - no release asset '${ASSET}' found in ${REPO} under any of: ${TAGS}" >&2; \ + echo "0g: aristotle and galileo are SEPARATE repos on SEPARATE version lines" >&2; \ + echo "0g: aristotle = 0gchain-Aristotle (1.0.x), galileo = 0gchain-NG (3.0.x)" >&2; \ + echo "0g: check that version '${ZERO_GRAVITY_VERSION}' exists for '${ZERO_GRAVITY_CHAIN_SPEC}'" >&2; \ + exit 1; \ fi + RUN tar -xzf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -C /tmp RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \ mv /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/rpc /0g; \ @@ -26,4 +61,4 @@ RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \ RUN chmod +x /0g/bin/0gchaind RUN chmod +x /0g/bin/geth -ENTRYPOINT [ "init.sh" ] \ No newline at end of file +ENTRYPOINT [ "init.sh" ]