From 47cfef6a6b259bffb04a75b97e108f2186bb8e25 Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Wed, 28 Aug 2024 14:12:30 -0400 Subject: [PATCH] use extract_commit instead of manually synced references in versions.sh --- scripts/versions.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/versions.sh b/scripts/versions.sh index 018f5d67..743d02ad 100755 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -13,18 +13,22 @@ function getDepVersion() { grep -m1 "^\s*$1" $BASE_PATH/go.mod | cut -d ' ' -f2 } +function extract_commit() { + local version=$1 + if [[ $version == *-* ]]; then + # Extract the substring after the last '-' + version=${version##*-} + fi + echo "$version" +} + # This needs to be exported to be picked up by the dockerfile. export GO_VERSION=${GO_VERSION:-$(getDepVersion go)} # Don't export them as they're used in the context of other calls -# TODO: undo this hack once go.mod is referring to a tag rather than a commit -#AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-$(getDepVersion github.com/ava-labs/avalanchego)} -AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-ab83fb41528de93c1790301cdd67a07dda9299f0} -GINKGO_VERSION=${GINKGO_VERSION:-$(getDepVersion github.com/onsi/ginkgo/v2)} - -# TODO: undo this hack once go.mod is referring to a tag rather than a commit -#SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-$(getDepVersion github.com/ava-labs/subnet-evm)} -SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-18633729a0cde7d695616e14b77873957a2b59c2} +AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-$(extract_commit "$(getDepVersion github.com/ava-labs/avalanchego)")} +GINKGO_VERSION=${GINKGO_VERSION:-$(extract_commit "$(getDepVersion github.com/onsi/ginkgo/v2)")} +SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-$(extract_commit "$(getDepVersion github.com/ava-labs/subnet-evm)")} # Set golangci-lint version GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION:-'v1.60'}