Simplify avalanchego version maintenance (#1469)

This commit is contained in:
maru
2025-03-10 09:31:21 +00:00
committed by GitHub
parent 658298cbeb
commit 2a8bec7a80
+21 -1
View File
@@ -4,5 +4,25 @@
# shellcheck disable=SC2034
# Don't export them as they're used in the context of other calls
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'f1ec9a13'}
if [[ -z ${AVALANCHE_VERSION:-} ]]; then
# Get module details from go.mod
MODULE_DETAILS="$(go list -m "github.com/ava-labs/avalanchego" 2>/dev/null)"
# Extract the version part
AVALANCHE_VERSION="$(echo "${MODULE_DETAILS}" | awk '{print $2}')"
# Check if the version matches the pattern where the last part is the module hash
# v*YYYYMMDDHHMMSS-abcdef123456
#
# If not, the value is assumed to represent a tag
if [[ "${AVALANCHE_VERSION}" =~ ^v.*[0-9]{14}-[0-9a-f]{12}$ ]]; then
# Extract module hash from version
MODULE_HASH="$(echo "${AVALANCHE_VERSION}" | cut -d'-' -f3)"
# The first 8 chars of the hash is used as the tag of avalanchego images
AVALANCHE_VERSION="${MODULE_HASH::8}"
fi
fi
GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}