zero-gravity: detect tarball layout; galileo 3.0.8 moved binaries to a shared root bin/
Fixes the de-32 build break introduced by vibe-node #2912 (galileo 3.0.3 -> 3.0.8, merged as bc4cecf). Job ad580587: #16 chmod: cannot access '/0g/bin/0gchaind': No such file or directory The Dockerfile hardcoded 'galileo -> mv <root>/rpc /0g'. That held for 3.0.3, where every profile dir carried its own copy of the binaries. 3.0.8 DEDUPLICATED them into a shared <root>/bin/ (168 MB -> 69 MB), leaving rpc/ as configs-only — so the move produced configs and no binaries, and the build died two layers later on a chmod. Note 'does <root>/rpc exist' is not a sufficient test: 3.0.8 still ships rpc/, it just no longer holds bin/. Verified layouts: galileo 3.0.3 <root>/{rpc,validator,archive,seed}/bin/ + configs galileo 3.0.8 <root>/bin/ shared + <root>/{rpc,...}/ configs aristotle 1.0.6 <root>/bin/ + configs, no profile dirs So: take configs from the profile dir when present, then top the binaries up from the shared root bin/ if the profile dir did not supply them. Also asserts both binaries exist immediately after extraction, naming the chain, the version and the known layouts — so the next upstream reshuffle reports itself at the point of failure rather than as an anonymous chmod error. Verified against the real artifacts — all three now yield an identical /0g (bin/0gchaind 76M, bin/geth 46M, geth-config.toml, geth-genesis.json, kzg-trusted-setup.json, 0g-home/, rollback_cl.sh), and a synthetic unknown layout exits 1 with the diagnostic instead of reaching chmod. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #63.
This commit is contained in:
@@ -48,17 +48,52 @@ RUN set -eu; \
|
||||
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; \
|
||||
# Extract by DETECTING the layout rather than assuming one per chain. 0G has shipped
|
||||
# three shapes so far and changed between them without notice:
|
||||
#
|
||||
# galileo <= 3.0.3 <root>/{rpc,validator,archive,seed}/bin/ + configs (168 MB)
|
||||
# -> binaries duplicated inside every profile dir
|
||||
# galileo >= 3.0.8 <root>/bin/ shared, + <root>/{rpc,...}/ configs (69 MB)
|
||||
# -> binaries DEDUPLICATED to the tarball root; rpc/ is configs-only
|
||||
# aristotle 1.0.x <root>/bin/ + configs, no profile dirs at all
|
||||
#
|
||||
# So "does <root>/rpc exist" is NOT sufficient: 3.0.8 still has rpc/, it just no longer
|
||||
# holds bin/. Take configs from the profile dir when present, then top the binaries up
|
||||
# from the shared root bin/ if the profile dir didn't supply them.
|
||||
#
|
||||
# The old code hardcoded "galileo -> mv <root>/rpc /0g", so 3.0.8 yielded configs but no
|
||||
# binaries and the build died two layers later at
|
||||
# `chmod: cannot access '/0g/bin/0gchaind'` — an error naming neither the chain, the
|
||||
# version, nor the layout. Assert on the binaries here so the NEXT upstream reshuffle
|
||||
# reports itself at the point of failure instead.
|
||||
RUN set -eu; \
|
||||
SRC="/tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \
|
||||
tar -xzf "${SRC}.tar.gz" -C /tmp; \
|
||||
mkdir -p /0g; \
|
||||
if [ -d "${SRC}/rpc" ]; then \
|
||||
echo "0g: profile dir found -> ${SRC}/rpc"; \
|
||||
cp -a "${SRC}/rpc/." /0g/; \
|
||||
else \
|
||||
mkdir -p /0g && \
|
||||
cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/* /0g/ 2>/dev/null || true; \
|
||||
cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/.[^.]* /0g/ 2>/dev/null || true; \
|
||||
rm -rf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}; \
|
||||
fi
|
||||
|
||||
RUN chmod +x /0g/bin/0gchaind
|
||||
RUN chmod +x /0g/bin/geth
|
||||
echo "0g: no profile dir -> using tarball root ${SRC}"; \
|
||||
cp -a "${SRC}/." /0g/; \
|
||||
fi; \
|
||||
if [ ! -f /0g/bin/0gchaind ] && [ -d "${SRC}/bin" ]; then \
|
||||
echo "0g: binaries not in the profile dir -> topping up from ${SRC}/bin"; \
|
||||
cp -a "${SRC}/bin" /0g/; \
|
||||
fi; \
|
||||
rm -rf "${SRC}"; \
|
||||
missing=""; \
|
||||
for b in 0gchaind geth; do \
|
||||
[ -f "/0g/bin/${b}" ] || missing="${missing} bin/${b}"; \
|
||||
done; \
|
||||
if [ -n "${missing}" ]; then \
|
||||
echo "0g: FATAL - missing after extraction:${missing}" >&2; \
|
||||
echo "0g: ${ZERO_GRAVITY_CHAIN_SPEC} v${ZERO_GRAVITY_VERSION} tarball layout not recognised." >&2; \
|
||||
echo "0g: known layouts are '<root>/rpc/bin/' (per-profile) and '<root>/bin/' (flat)." >&2; \
|
||||
echo "0g: contents of /0g were:" >&2; \
|
||||
ls -la /0g >&2 || true; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
chmod +x /0g/bin/0gchaind /0g/bin/geth
|
||||
|
||||
ENTRYPOINT [ "init.sh" ]
|
||||
|
||||
Reference in New Issue
Block a user