build-image.sh: wire-correct version builds (tag-move so getVersion() exact-matches; dRPC edges track provider version strings)

This commit is contained in:
rob
2026-07-30 07:12:00 +00:00
parent a287e74bd7
commit 0cbe8ba2e8

32
build-image.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# build-image.sh — build the StakeSquid dshackle fork image with a WIRE-CORRECT version.
#
# dRPC edges record each provider's dshackle version (Global.version, sent in every
# Describe response and SubscribeChainStatus BuildInfo) and deprioritize providers
# whose string doesn't match the expected release. gradle's getVersion() only yields
# the clean release string on an EXACT tag match; one patch commit past the tag would
# report "<next>-SNAPSHOT" to every edge. So: force-move the base release tag onto the
# patch HEAD locally before building (never push that tag), which makes our build
# report exactly what stock drpcorg/dshackle:<version> reports (verified against a
# live gateway: version.app=0.79.10).
#
# Usage: ./build-image.sh [base-tag] [suffix]
# base-tag: upstream release our branch is based on (default v0.79.10)
# suffix: local image tag suffix (default ss1) -> stakesquid/dshackle:<ver>-<suffix>
#
# Per upstream release: rebase reload-removal onto the new tag, bump the default here,
# rerun. Distribute with: docker save stakesquid/dshackle:<ver>-<suffix> | ssh <gw> docker load
set -euo pipefail
cd "$(dirname "$0")"
BASE_TAG=${1:-v0.79.10}
SUFFIX=${2:-ss1}
VER=${BASE_TAG#v}
git tag -f "$BASE_TAG" HEAD >/dev/null # local only - makes getVersion() exact-match
docker build -q -t drpc-dshackle . >/dev/null
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-21-openjdk-amd64}
./gradlew jibDockerBuild -Djib.to.image="stakesquid/dshackle:${VER}-${SUFFIX}" -x test
echo "--- wire version check (must equal stock ${VER}):"
docker run --rm --entrypoint cat "stakesquid/dshackle:${VER}-${SUFFIX}" \
/app/resources/version.properties