Skip to content

Commit

Permalink
feat(build-chain): support commit hashes and tags that do not start w…
Browse files Browse the repository at this point in the history
…ith `v` (#460)

* feat(build-chain): support commit hash

* feat(build-chain): support git tags that do not begin with `v`
  • Loading branch information
0xpatrickdev authored Jun 5, 2024
1 parent 3bcd70a commit 1821c44
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions starship/charts/devnet/scripts/default/build-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ echo "Fetching code from tag"
mkdir -p /tmp/chains/$CHAIN_NAME
cd /tmp/chains/$CHAIN_NAME

if [[ $CODE_TAG = v* ]]; then
echo "Trying to fetch code from tag"
if [[ $CODE_TAG =~ ^[0-9a-fA-F]{40}$ ]]; then
echo "Trying to fetch code from commit hash"
curl -LO $CODE_REPO/archive/$CODE_TAG.zip
unzip $CODE_TAG.zip
code_dir=${CODE_REPO##*/}-${CODE_TAG}
elif [[ $CODE_TAG = v* ]]; then
echo "Trying to fetch code from tag with 'v' prefix"
curl -LO $CODE_REPO/archive/refs/tags/$CODE_TAG.zip
unzip $CODE_TAG.zip
code_dir=${CODE_REPO##*/}-${CODE_TAG#"v"}
else
echo "Trying to fetch code from branch"
curl -LO $CODE_REPO/archive/refs/heads/$CODE_TAG.zip
unzip $(echo $CODE_TAG | rev | cut -d "/" -f 1 | rev).zip
code_dir=${CODE_REPO##*/}-${CODE_TAG/\//-}
echo "Trying to fetch code from tag or branch"
if curl -fsLO $CODE_REPO/archive/refs/tags/$CODE_TAG.zip; then
unzip $CODE_TAG.zip
code_dir=${CODE_REPO##*/}-$CODE_TAG
elif curl -fsLO $CODE_REPO/archive/refs/heads/$CODE_TAG.zip; then
unzip $(echo $CODE_TAG | rev | cut -d "/" -f 1 | rev).zip
code_dir=${CODE_REPO##*/}-${CODE_TAG/\//-}
else
echo "Tag or branch '$CODE_TAG' not found"
exit 1
fi
fi

echo "Fetch wasmvm if needed"
Expand Down

0 comments on commit 1821c44

Please sign in to comment.